Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shared workbook - to save or not to save bluebird Excel Discussion (Misc queries) 1 November 14th 06 06:17 PM
Save column J of WorkBook when WorkBook is not saved. mikeburg[_84_] Excel Programming 2 June 14th 06 09:57 PM
Select sheet tabs in workbook & save to separate workbook files stratocaster Excel Worksheet Functions 2 March 1st 06 03:35 PM
Using interop.excel to open a workbook, the workbook doesn't ask to save changes. [email protected] Excel Programming 1 December 28th 05 10:23 PM
What commands do you use to name a workbook, save a workbook,open a workbook Steven R. Berke Excel Programming 1 July 24th 03 11:37 PM


All times are GMT +1. The time now is 12:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"