Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
B Baggins
 
Posts: n/a
Default Using "Save As" with a file name selected by cell

I am trying to save a worksheet where the Save As dialog box appears so the
user can choose the location. I need the file name to be predefined from a
cell entry.

The following works by saving the file as "Data - (A1).xls" where A1 is a
variable but it saves in the current folder only. How can I use the Save As
dialog box so that the new file name appears by default and the user can then
select the location?

Sub SaveWithVariableFromCell()
Application.DisplayAlerts = False
Dim SaveName As String
SaveName = ActiveSheet.Range("A1").Text
ActiveWorkbook.SaveAs Filename:="Data - " & SaveName & ".xls"
End Sub

Many thanks

  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

So you want to allow the user to control the drive/folder, but you want to
specify the filename?

If yes, maybe just asking for the drive/folder would be better:

Jim Rech has a BrowseForFolder routine at:
http://www.oaltd.co.uk/MVP/Default.htm
(look for BrowseForFolder)

John Walkenbach has one at:
http://j-walk.com/ss/excel/tips/tip29.htm

If you and all your users are running xl2002+, take a look at VBA's help for:
application.filedialog(msoFileDialogFolderPicker)

B Baggins wrote:

I am trying to save a worksheet where the Save As dialog box appears so the
user can choose the location. I need the file name to be predefined from a
cell entry.

The following works by saving the file as "Data - (A1).xls" where A1 is a
variable but it saves in the current folder only. How can I use the Save As
dialog box so that the new file name appears by default and the user can then
select the location?

Sub SaveWithVariableFromCell()
Application.DisplayAlerts = False
Dim SaveName As String
SaveName = ActiveSheet.Range("A1").Text
ActiveWorkbook.SaveAs Filename:="Data - " & SaveName & ".xls"
End Sub

Many thanks


--

Dave Peterson
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
Can I get excel to auto save details from a cell into the doc nam. excelnewbie Excel Worksheet Functions 3 September 16th 05 07:35 AM
Perform oiperations relative to initial selected cell scratching my head Excel Discussion (Misc queries) 1 May 30th 05 05:42 PM
a protected cell w/formula only updates only on file save? snap Excel Discussion (Misc queries) 2 May 18th 05 12:35 PM
Excell2003 (SP-1) File > Save and File > Save As.. grayed out Joe Murphy Excel Discussion (Misc queries) 0 March 9th 05 10:00 PM
How do I use a cell as a referance to a file in a lookup statemen. SarahP Excel Worksheet Functions 1 January 27th 05 11:09 PM


All times are GMT +1. The time now is 07:58 PM.

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"