Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Prompt for Save As Window through macro

Hello,
Im trying to create a macro that opens the file save as window with a
prefilled fill name and file format and allows me to save the file when I
click on the save button in the save as window.
The save as window opens, but when I click save the window closes and the
file is not saved.
Below is the code. Any suggestions are greatly appreciated.

Private Sub CommandButton2_Click()

Dim fileSaveName As String
fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:=Range("B1").Value, _
FileFilter:="Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Prompt for Save As Window through macro

You're only getting the name, not actually saving the workbook.

Add the line

ActiveWorkbook.SaveAs fileSaveName


HTH,
Bernie
MS Excel MVP


"h2fcell" wrote in message
...
Hello,
I'm trying to create a macro that opens the file save as window with a
prefilled fill name and file format and allows me to save the file when I
click on the save button in the save as window.
The save as window opens, but when I click save the window closes and the
file is not saved.
Below is the code. Any suggestions are greatly appreciated.

Private Sub CommandButton2_Click()

Dim fileSaveName As String
fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:=Range("B1").Value, _
FileFilter:="Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Prompt for Save As Window through macro

Hi,

Try this

Dim fileSaveName As String
fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:=Range("B1").Value, _
FileFilter:="Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")
If fileSaveName < "" Then ActiveWorkbook.SaveAs fileSaveName

Mike

"h2fcell" wrote:

Hello,
Im trying to create a macro that opens the file save as window with a
prefilled fill name and file format and allows me to save the file when I
click on the save button in the save as window.
The save as window opens, but when I click save the window closes and the
file is not saved.
Below is the code. Any suggestions are greatly appreciated.

Private Sub CommandButton2_Click()

Dim fileSaveName As String
fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:=Range("B1").Value, _
FileFilter:="Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")

End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Prompt for Save As Window through macro

OOPS,

I meant to say

If fileSaveName < False Then ActiveWorkbook.SaveAs fileSaveName

In case the user presses cancel.

Mike

"Mike H" wrote:

Hi,

Try this

Dim fileSaveName As String
fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:=Range("B1").Value, _
FileFilter:="Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")
If fileSaveName < "" Then ActiveWorkbook.SaveAs fileSaveName

Mike

"h2fcell" wrote:

Hello,
Im trying to create a macro that opens the file save as window with a
prefilled fill name and file format and allows me to save the file when I
click on the save button in the save as window.
The save as window opens, but when I click save the window closes and the
file is not saved.
Below is the code. Any suggestions are greatly appreciated.

Private Sub CommandButton2_Click()

Dim fileSaveName As String
fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:=Range("B1").Value, _
FileFilter:="Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")

End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Prompt for Save As Window through macro

Thank you so very much.

"Mike H" wrote:

Hi,

Try this

Dim fileSaveName As String
fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:=Range("B1").Value, _
FileFilter:="Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")
If fileSaveName < "" Then ActiveWorkbook.SaveAs fileSaveName

Mike

"h2fcell" wrote:

Hello,
Im trying to create a macro that opens the file save as window with a
prefilled fill name and file format and allows me to save the file when I
click on the save button in the save as window.
The save as window opens, but when I click save the window closes and the
file is not saved.
Below is the code. Any suggestions are greatly appreciated.

Private Sub CommandButton2_Click()

Dim fileSaveName As String
fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:=Range("B1").Value, _
FileFilter:="Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")

End Sub



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default Prompt for Save As Window through macro

try somthing like ...

Option Explicit

Sub Human()
Dim FileName As String

FileName = "YourFileName"

Application.Dialogs(xlDialogSaveAs).Show (FileName)
End Sub


"h2fcell" wrote:

Hello,
Im trying to create a macro that opens the file save as window with a
prefilled fill name and file format and allows me to save the file when I
click on the save button in the save as window.
The save as window opens, but when I click save the window closes and the
file is not saved.
Below is the code. Any suggestions are greatly appreciated.

Private Sub CommandButton2_Click()

Dim fileSaveName As String
fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:=Range("B1").Value, _
FileFilter:="Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")

End Sub

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Prompt for Save As Window through macro


If fileSaveName < False Then ActiveWorkbook.SaveAs fileSaveName


In which case you need to declare fileSaveName as Variant, not String.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)

On Wed, 10 Dec 2008 08:01:01 -0800, Mike H
wrote:

OOPS,

I meant to say

If fileSaveName < False Then ActiveWorkbook.SaveAs fileSaveName

In case the user presses cancel.

Mike

"Mike H" wrote:

Hi,

Try this

Dim fileSaveName As String
fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:=Range("B1").Value, _
FileFilter:="Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")
If fileSaveName < "" Then ActiveWorkbook.SaveAs fileSaveName

Mike

"h2fcell" wrote:

Hello,
I’m trying to create a macro that opens the file save as window with a
prefilled fill name and file format and allows me to save the file when I
click on the save button in the save as window.
The save as window opens, but when I click save the window closes and the
file is not saved.
Below is the code. Any suggestions are greatly appreciated.

Private Sub CommandButton2_Click()

Dim fileSaveName As String
fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:=Range("B1").Value, _
FileFilter:="Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")

End Sub

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Prompt for Save As Window through macro

Thanks, I forgot to alter that while correcting the error in my first post

"Chip Pearson" wrote:


If fileSaveName < False Then ActiveWorkbook.SaveAs fileSaveName


In which case you need to declare fileSaveName as Variant, not String.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)

On Wed, 10 Dec 2008 08:01:01 -0800, Mike H
wrote:

OOPS,

I meant to say

If fileSaveName < False Then ActiveWorkbook.SaveAs fileSaveName

In case the user presses cancel.

Mike

"Mike H" wrote:

Hi,

Try this

Dim fileSaveName As String
fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:=Range("B1").Value, _
FileFilter:="Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")
If fileSaveName < "" Then ActiveWorkbook.SaveAs fileSaveName

Mike

"h2fcell" wrote:

Hello,
Im trying to create a macro that opens the file save as window with a
prefilled fill name and file format and allows me to save the file when I
click on the save button in the save as window.
The save as window opens, but when I click save the window closes and the
file is not saved.
Below is the code. Any suggestions are greatly appreciated.

Private Sub CommandButton2_Click()

Dim fileSaveName As String
fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:=Range("B1").Value, _
FileFilter:="Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")

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
Need simple prompt to save at end of macro KelliInCali Excel Programming 4 September 11th 06 06:54 PM
save prompt for user exit, but no save prompt for batch import? lpj Excel Discussion (Misc queries) 1 February 25th 06 02:08 AM
How to CANCEL file SAVE PROMPT when MACRO is running? Stuart Macro Muppet Excel Discussion (Misc queries) 3 August 11th 05 12:26 PM
CLOSE ALL macro for XL2K (but with prompt to save for each file)? StargateFan[_3_] Excel Programming 2 August 10th 05 02:32 PM
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 11:01 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"