Hi,
Im having problems getting my code to create and dynamically name and save workbooks. Ive included some of the following code, leaving out the unecessary workbook operations.
Dim path, extension, name As String
Application.ScreenUpdating = False
path = "G:\Izac\"
extension = ".xls"
For i = 1 To valueCount
'Create New Workbook and Set Sheet Names
Set newWB = Workbooks.Add
newWB.Worksheets.Item(1).name = ("Summary")
newWB.Worksheets.Item(2).name = ("Summary With Line")
'Set Path And Save
name = path & TLnames(i) & extension
newWB.SaveAs (path)
Next i
End Sub
TLnames is a global variable with a set of names. Ive checked that name is as it should be both in lenght and content.
I get a run time error 1004.
"The file could not be accessed"
Any ideas as to what Im doing wrong.
Thanks
Izac
Im having problems getting my code to create and dynamically name and save workbooks. Ive included some of the following code, leaving out the unecessary workbook operations.
Dim path, extension, name As String
Application.ScreenUpdating = False
path = "G:\Izac\"
extension = ".xls"
For i = 1 To valueCount
'Create New Workbook and Set Sheet Names
Set newWB = Workbooks.Add
newWB.Worksheets.Item(1).name = ("Summary")
newWB.Worksheets.Item(2).name = ("Summary With Line")
'Set Path And Save
name = path & TLnames(i) & extension
newWB.SaveAs (path)
Next i
End Sub
TLnames is a global variable with a set of names. Ive checked that name is as it should be both in lenght and content.
I get a run time error 1004.
"The file could not be accessed"
Any ideas as to what Im doing wrong.
Thanks
Izac