Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Need VBA code for Save As dialog

I am trying to create a button that will pick a value from a specified cell
and put up a Save As dialog pre-filled with the name of the file as
Value-I-Picked.xls and the suggested path as the path of the workbook I
originally opened.

Where can I find suggestions for appropriate code?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Need VBA code for Save As dialog

Bill,

Use code like the following:

Dim FName As Variant
FName = Application.GetSaveAsFilename( _
InitialFileName:="MyFile.xls", _
filefilter:="Excel Files (*.xls),*.xls")
If FName = False Then
' user cancelled
Else
' user selected FName
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Bill Sturdevant"
wrote in message
...
I am trying to create a button that will pick a value from a
specified cell
and put up a Save As dialog pre-filled with the name of the
file as
Value-I-Picked.xls and the suggested path as the path of the
workbook I
originally opened.

Where can I find suggestions for appropriate code?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Need VBA code for Save As dialog

sStr = Thisworkbook.Path & "\" & activecell.value & ".xls"

fname = application.GetSaveAsFileName( InitialFileName:=sStr)

--
Regards,
Tom Ogilvy




"Bill Sturdevant" wrote in
message ...
I am trying to create a button that will pick a value from a specified

cell
and put up a Save As dialog pre-filled with the name of the file as
Value-I-Picked.xls and the suggested path as the path of the workbook I
originally opened.

Where can I find suggestions for appropriate code?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Need VBA code for Save As dialog

To get the save as dialog use

Application.Dialogs(xlDialogSaveAs).Show fname

HTH

"Tom Ogilvy" wrote:

sStr = Thisworkbook.Path & "\" & activecell.value & ".xls"

fname = application.GetSaveAsFileName( InitialFileName:=sStr)

--
Regards,
Tom Ogilvy




"Bill Sturdevant" wrote in
message ...
I am trying to create a button that will pick a value from a specified

cell
and put up a Save As dialog pre-filled with the name of the file as
Value-I-Picked.xls and the suggested path as the path of the workbook I
originally opened.

Where can I find suggestions for appropriate code?




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Need VBA code for Save As dialog

Sorry I accidentally hit post too fast. Tom. What is the difference between

Application.Dialogs(xlDialogSaveAs).Show sStr

and

fname = application.GetSaveAsFileName( InitialFileName:=sStr)

?

"Jim Thomlinson" wrote:

To get the save as dialog use

Application.Dialogs(xlDialogSaveAs).Show fname

HTH

"Tom Ogilvy" wrote:

sStr = Thisworkbook.Path & "\" & activecell.value & ".xls"

fname = application.GetSaveAsFileName( InitialFileName:=sStr)

--
Regards,
Tom Ogilvy




"Bill Sturdevant" wrote in
message ...
I am trying to create a button that will pick a value from a specified

cell
and put up a Save As dialog pre-filled with the name of the file as
Value-I-Picked.xls and the suggested path as the path of the workbook I
originally opened.

Where can I find suggestions for appropriate code?






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Need VBA code for Save As dialog

Jim,

GetSaveAsFileName simply returns a filename (or False if the user
cancels the dialog). It doesn't actually do the save. Displaying
the xlDialogSaveAs will carry out the save operation.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Jim Thomlinson" wrote
in message
...
Sorry I accidentally hit post too fast. Tom. What is the
difference between

Application.Dialogs(xlDialogSaveAs).Show sStr

and

fname = application.GetSaveAsFileName( InitialFileName:=sStr)

?

"Jim Thomlinson" wrote:

To get the save as dialog use

Application.Dialogs(xlDialogSaveAs).Show fname

HTH

"Tom Ogilvy" wrote:

sStr = Thisworkbook.Path & "\" & activecell.value & ".xls"

fname = application.GetSaveAsFileName(
InitialFileName:=sStr)

--
Regards,
Tom Ogilvy




"Bill Sturdevant"
wrote in
message
...
I am trying to create a button that will pick a value from
a specified
cell
and put up a Save As dialog pre-filled with the name of
the file as
Value-I-Picked.xls and the suggested path as the path of
the workbook I
originally opened.

Where can I find suggestions for appropriate code?





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Need VBA code for Save As dialog

Thanks... That was quicker than looking it up... :-)

"Chip Pearson" wrote:

Jim,

GetSaveAsFileName simply returns a filename (or False if the user
cancels the dialog). It doesn't actually do the save. Displaying
the xlDialogSaveAs will carry out the save operation.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Jim Thomlinson" wrote
in message
...
Sorry I accidentally hit post too fast. Tom. What is the
difference between

Application.Dialogs(xlDialogSaveAs).Show sStr

and

fname = application.GetSaveAsFileName( InitialFileName:=sStr)

?

"Jim Thomlinson" wrote:

To get the save as dialog use

Application.Dialogs(xlDialogSaveAs).Show fname

HTH

"Tom Ogilvy" wrote:

sStr = Thisworkbook.Path & "\" & activecell.value & ".xls"

fname = application.GetSaveAsFileName(
InitialFileName:=sStr)

--
Regards,
Tom Ogilvy




"Bill Sturdevant"
wrote in
message
...
I am trying to create a button that will pick a value from
a specified
cell
and put up a Save As dialog pre-filled with the name of
the file as
Value-I-Picked.xls and the suggested path as the path of
the workbook I
originally opened.

Where can I find suggestions for appropriate code?






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
Save as dialog David T Excel Discussion (Misc queries) 7 September 28th 07 05:12 PM
how to get disk icon on save button of save as dialog like 2000 RichT Excel Discussion (Misc queries) 2 March 9th 06 08:13 PM
VBA code to show a save as dialog does not work Kevin Excel Programming 4 November 17th 03 08:36 AM
Changing Save As Type in Save as dialog box Phill Excel Programming 2 August 22nd 03 12:38 PM
Save As Dialog Bob Phillips[_5_] Excel Programming 0 July 8th 03 11:09 PM


All times are GMT +1. The time now is 03:43 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"