![]() |
save workbook as different name
Hi all,
I need to be able to save the active workbook by including the name which appears in a combo box on the users sheet into the file Path/Name. I can save the file by having a complete Path/Name but need to be able to concatenate the selection with the given path. The following code returns an 'object required' error. Can anyone help? D Sub SaveFile() Dim fs As Object Dim strFile As String Dim strNewFile As String Dim FilePath As String Set FilePath = ("\\Blah Blah Blah\") strFile = ThisWorkbook.Name strNewFile = "\\Blah Blah Blah\" & cboxProjectList.Value & "\.xls" Set fs = CreateObject("Scripting.FileSystemObject") fs.CopyFile strFile, strNewFile MsgBox "Your file has been saved" End Sub |
save workbook as different name
Hi Damien
Try using application.ActiveWorkbook.SaveAs filename, fileformat etc. etc. see help and exmaple for SaveAs HTH KM "Damien" wrote: Hi all, I need to be able to save the active workbook by including the name which appears in a combo box on the users sheet into the file Path/Name. I can save the file by having a complete Path/Name but need to be able to concatenate the selection with the given path. The following code returns an 'object required' error. Can anyone help? D Sub SaveFile() Dim fs As Object Dim strFile As String Dim strNewFile As String Dim FilePath As String Set FilePath = ("\\Blah Blah Blah\") strFile = ThisWorkbook.Name strNewFile = "\\Blah Blah Blah\" & cboxProjectList.Value & "\.xls" Set fs = CreateObject("Scripting.FileSystemObject") fs.CopyFile strFile, strNewFile MsgBox "Your file has been saved" End Sub |
All times are GMT +1. The time now is 03:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com