save workbook as different name

D

Damien

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
 
K

Kevin McCartney

Hi Damien

Try using

application.ActiveWorkbook.SaveAs filename, fileformat etc. etc.

see help and exmaple for SaveAs

HTH
KM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top