Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
J S J S is offline
external usenet poster
 
Posts: 11
Default Prompt user for a filename

I want to create an excel macro that display the saveas dialog box to the
user, how do I do that?

i.e. I want the user to save the current document, but when I use
thisworkbook.save or thisworkbook.saveas excel does NOT display the saveas
dialog box where the user can select the filename and directory he wants to
save to.

-J


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Prompt user for a filename

You can use the GetSaveAsFilename method. An example is shown below. For more
information, you can search for the topic "GetSaveAsFilename method" in the
VBA online help.

Sub obtain_filename()
Dim fileSaveName As String
fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:="MyFile", FileFilter:="Text Files (*.txt), *.txt")
If fileSaveName < False Then
MsgBox "Save as " & fileSaveName
End If
End Sub

Regards,
Edwin Tam

http://www.vonixx.com





"J S" wrote:

I want to create an excel macro that display the saveas dialog box to the
user, how do I do that?

i.e. I want the user to save the current document, but when I use
thisworkbook.save or thisworkbook.saveas excel does NOT display the saveas
dialog box where the user can select the filename and directory he wants to
save to.

-J



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Prompt user for a filename

Application.Dialogs(xlDialogSaveAs).Show "C:\Myfile.xls"

HTH

"J S" wrote:

I want to create an excel macro that display the saveas dialog box to the
user, how do I do that?

i.e. I want the user to save the current document, but when I use
thisworkbook.save or thisworkbook.saveas excel does NOT display the saveas
dialog box where the user can select the filename and directory he wants to
save to.

-J



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Prompt user for a filename

Use the GetSaveAsFilename method.
From Excel Helpfile:
fileSaveName = Application.GetSaveAsFilename( _
fileFilter:="Text Files (*.txt), *.txt")
If fileSaveName < False Then
MsgBox "Save as " & fileSaveName
End If

Then you can use the SaveAs method to save the fileSaveName

Hans Petter


"J S" skrev i melding ...
I want to create an excel macro that display the saveas dialog box to the
user, how do I do that?

i.e. I want the user to save the current document, but when I use
thisworkbook.save or thisworkbook.saveas excel does NOT display the saveas
dialog box where the user can select the filename and directory he wants

to
save to.

-J




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
Excel macro to prompt for filename [email protected] Excel Discussion (Misc queries) 8 January 4th 07 01:31 AM
save prompt for user exit, but no save prompt for batch import? lpj Excel Discussion (Misc queries) 1 February 25th 06 02:08 AM
Help with user prompt Rob Gould Excel Discussion (Misc queries) 5 March 14th 05 12:38 PM
Prompt user automatically gavmer[_29_] Excel Programming 10 June 15th 04 04:00 AM
Can a MACRO prompt for the filename to open and/or save? Dave Peterson[_3_] Excel Programming 1 September 3rd 03 04:53 PM


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