The following code works fine on my PC (Excel 2000, Win NT Pro), and most of the users I've tested this with, but some people get a "compile error in hidden module".
I've sent a copy of the above code to affected users with the VBA project unlocked and I am led to believe that the error message is "Cannot find project or library".
I know that some users will have problems connecting to the specified location and was hoping that "On error resume next" would mean that they don't get an error.
To be honest, I don't really understand the "f = FreeFile" - "Close #f" lines - I adapted copied and adapted them from somewhere else.
Can anyone suggest bullet-proof amendments to the code that will help it run safely on Win98, WinXP, WinNT and Excel 97 and 2000?
Thanks,
Code:
Option Explicit
Sub test5()
Dim f As Integer
Dim LogFile As String
Dim TempStr1, TempStr2, TempStr3, TempStr4, TempStr5, TempStr6, TempStr7
Err.Clear
On Error Resume Next
TempStr1 = Format(Date, "yyyy mm")
LogFile = "\\Gbtdc036\UKNMSC\PPI\PPI Workbook 2003\S - Standards & Procedures\3point BottomUp Estimating\"
LogFile = LogFile & TempStr1
LogFile = LogFile & "3pointTool usage log.csv"
TempStr1 = Format(Now, "yyyy-mm-dd hh:mm:ss")
TempStr2 = Application.UserName
TempStr3 = "B"
TempStr4 = "C"
TempStr5 = ThisWorkbook.FullName
TempStr6 = "0.b Tests"
TempStr7 = "Opened"
f = FreeFile
Open LogFile For Append As #f
Write #f, TempStr1, TempStr2, TempStr3, TempStr4, TempStr5, TempStr6, TempStr7
Close #f
If Err.Number <> 0 Then
Worksheets("sheet1").Range("B8").Value = "Failed log test - Error:" & Err.Number
Else
Worksheets("sheet1").Range("B8").Value = "Passed log test"
End If
Err.Clear
End Sub
I've sent a copy of the above code to affected users with the VBA project unlocked and I am led to believe that the error message is "Cannot find project or library".
I know that some users will have problems connecting to the specified location and was hoping that "On error resume next" would mean that they don't get an error.
To be honest, I don't really understand the "f = FreeFile" - "Close #f" lines - I adapted copied and adapted them from somewhere else.
Can anyone suggest bullet-proof amendments to the code that will help it run safely on Win98, WinXP, WinNT and Excel 97 and 2000?
Thanks,