Hi,
I have the following problem with the following code:
Private Sub Workbook_Open()
Application.WindowState = xlMinimized
'Trial Version
'Call Module6.mtDateTestA_2
UserForm1.Show vbModeless
Dim objFSO, fso
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim fileToOpen
fileToOpen = Application.GetOpenFilename("Text Files (*.txt), *.txt", , "Select file to copy")
If fileToOpen = False Then
MsgBox ("File to copy not selected")
Exit Sub
End If
fileSaveName = Application.GetSaveAsFilename(fileFilter:="Text Files (*.txt), *.txt", Title:="Select path and file name to copy file")
If fileSaveName = False Then
MsgBox ("File to save not selected")
Exit Sub
End If
Set fso = objFSO.GetFile(fileToOpen) 'Source file
fso.Copy (fileSaveName) 'Destination file
End Sub
In my computer it runs perfectly, but in other, reports an error when it reaches: "fileSaveName". The error is: "Compile error in hiden module:This workbook".
I've concluded that it breaks when it founds a variable not defined. I didn't put "Object explicit" at the beginning, so it shouldn't be a problem....
The strange thing is that in my computer it works fine.
Anyone can help me?
Bookmarks