#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 47
Default Save As Macro

Office Basic 2003 - XP - Excel

I need a macro that will bring up the "Save As" window when button is
selected and to also insert a particular cell value in name field of "Save
As" window, then if possible to also save and exit all with this one macro.
I am a novice at this so a little extra explanation with it would be great.

I've been trying to use this macro that was posted but having trouble:

Sub SaveAs()
'Open the save as dialog box and show the value from A1
Dim myValue As String

myValue = ActiveSheet.Range("A1").Value
Dim fd As Dialog
Set fd = Application.Dialogs(xlDialogSaveAs)

If fd.Show(myValue) = False Then
'User pressed cancel, sheet not saved
'Add any additional code here if necessary
Else
'User has saved the file, update the data in range A1
'Run SetDate macro
SetDate
End If
End Sub


Thanks,
Guy

--
GT
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 47
Default Save As Macro

Update:
The cell value I wish to save with this macro is the current Date that is
inserted into the cell with the macro:

Sub SetDate4()
'Set cell A1 to the current date
ActiveSheet.Range("E2").Value = Date
End Sub

I get the "Save As" macro to partially work with:

Sub SaveAs4()
'Open the save as dialog box and show the value from E2
Dim myValue As String

myValue = ActiveSheet.Range("E2").Value
Dim fd As Dialog
Set fd = Application.Dialogs(xlDialogSaveAs)

If fd.Show(myValue) = False Then
'User pressed cancel, sheet not saved
'Add any additional code here if necessary
Else
'User has saved the file, update the data in range E2
End If
End Sub

It displays the "Save As" window with the date inserted into the name field,
which is what I want but the problem with this is that it puts the date in
formatted as 12/12/2008 and that cannot be saved. It needs to be formated as
12-12-08 *( - instead of / ). The cell on the sheet is formatted to
display 12-12-08 but when it is inserted into the "Save As" window it is
inserted as 12/12/2008 which cannot be saved.
Can someone help with this?

--
GT


"Guy" wrote:

Office Basic 2003 - XP - Excel

I need a macro that will bring up the "Save As" window when button is
selected and to also insert a particular cell value in name field of "Save
As" window, then if possible to also save and exit all with this one macro.
I am a novice at this so a little extra explanation with it would be great.

I've been trying to use this macro that was posted but having trouble:

Sub SaveAs()
'Open the save as dialog box and show the value from A1
Dim myValue As String

myValue = ActiveSheet.Range("A1").Value
Dim fd As Dialog
Set fd = Application.Dialogs(xlDialogSaveAs)

If fd.Show(myValue) = False Then
'User pressed cancel, sheet not saved
'Add any additional code here if necessary
Else
'User has saved the file, update the data in range A1
'Run SetDate macro
SetDate
End If
End Sub


Thanks,
Guy

--
GT

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Save As Macro

12/12/08 is ambiguous and will depend upon Regional Settings

Mine are dd/mm/yy

Sub SetDate4()
'Set cell E2 to the current date
ActiveSheet.Range("E2").Value = Format(Date, "dd-mm-yy")
End Sub

Works for me today(Dec 13th)


Gord Dibben MS Excel MVP




On Fri, 12 Dec 2008 19:21:00 -0800, Guy
wrote:

Update:
The cell value I wish to save with this macro is the current Date that is
inserted into the cell with the macro:

Sub SetDate4()
'Set cell A1 to the current date
ActiveSheet.Range("E2").Value = Date
End Sub

I get the "Save As" macro to partially work with:

Sub SaveAs4()
'Open the save as dialog box and show the value from E2
Dim myValue As String

myValue = ActiveSheet.Range("E2").Value
Dim fd As Dialog
Set fd = Application.Dialogs(xlDialogSaveAs)

If fd.Show(myValue) = False Then
'User pressed cancel, sheet not saved
'Add any additional code here if necessary
Else
'User has saved the file, update the data in range E2
End If
End Sub

It displays the "Save As" window with the date inserted into the name field,
which is what I want but the problem with this is that it puts the date in
formatted as 12/12/2008 and that cannot be saved. It needs to be formated as
12-12-08 *( - instead of / ). The cell on the sheet is formatted to
display 12-12-08 but when it is inserted into the "Save As" window it is
inserted as 12/12/2008 which cannot be saved.
Can someone help with this?


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
Macro to Insert Current Date into cell - Macro to "Save As" Guy[_2_] Excel Worksheet Functions 4 December 12th 08 08:20 PM
save as macro KJ Excel Discussion (Misc queries) 2 March 7th 08 04:37 PM
MACRO SAVE HELP DP7 Excel Worksheet Functions 2 October 17th 07 08:01 PM
Save As Macro el zorro[_2_] Excel Discussion (Misc queries) 3 July 18th 07 12:28 AM
Macro to Save without the Save Message Ellen G Excel Discussion (Misc queries) 4 February 23rd 07 08:52 PM


All times are GMT +1. The time now is 06:57 PM.

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

About Us

"It's about Microsoft Excel"