View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Damien Damien is offline
external usenet poster
 
Posts: 42
Default 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