V
Vacuum Sealed
Hi All
I have been using this code for some time, the only difference today is that
I decided to move this particular code from 1 module to another.
And now it's throwing up an error at the start of this line:
FileToOpen
Variable not Defined
Sub ImportSchedData()
Dim SDataWb As Workbook, TDataWb As Workbook
ChDrive "T:\"
ChDir "T:\VIC\Scheduler"
FileToOpen = Application.GetOpenFilename _
(Title:="Select a TMS File to Import", _
FileFilter:="Excel Files *.xls (*.xls),")
If FileToOpen = False Then
MsgBox "No file specified.", vbExclamation, "Doh!!!"
Exit Sub
Else
Workbooks.Open Filename:=FileToOpen
End If
Set SDataWb = Workbooks.Open(Filename:=FileToOpen)
Set TDataWb = Workbooks("VicMaster.xls")
SDataWb.Sheets("Main").Range("A2:Q500").Copy
Windows("VicMaster.xls").Activate
Sheets("Master").Select
Range("A5").Select
ActiveSheet.Paste
Application.CutCopyMode = False
SDataWb.Close noSave
End Sub
II spent an hour on it trying different things, and it's got me beat.
Any thoughts
TIA
Mick.
I have been using this code for some time, the only difference today is that
I decided to move this particular code from 1 module to another.
And now it's throwing up an error at the start of this line:
FileToOpen
Variable not Defined
Sub ImportSchedData()
Dim SDataWb As Workbook, TDataWb As Workbook
ChDrive "T:\"
ChDir "T:\VIC\Scheduler"
FileToOpen = Application.GetOpenFilename _
(Title:="Select a TMS File to Import", _
FileFilter:="Excel Files *.xls (*.xls),")
If FileToOpen = False Then
MsgBox "No file specified.", vbExclamation, "Doh!!!"
Exit Sub
Else
Workbooks.Open Filename:=FileToOpen
End If
Set SDataWb = Workbooks.Open(Filename:=FileToOpen)
Set TDataWb = Workbooks("VicMaster.xls")
SDataWb.Sheets("Main").Range("A2:Q500").Copy
Windows("VicMaster.xls").Activate
Sheets("Master").Select
Range("A5").Select
ActiveSheet.Paste
Application.CutCopyMode = False
SDataWb.Close noSave
End Sub
II spent an hour on it trying different things, and it's got me beat.
Any thoughts
TIA
Mick.