Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save As
I am trying to set up a macro in a workbook so that when I run the macro the
file will Save As and prompt for a new file name. I would like to have the old file name show in the box as I only need to change a few caracters. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save As
I also need to switch back and forth between two workbooks with this same
macro. After I have specified the file name is there any way that the rest of the macro will be able to call the workbook with the new name. "kdreyer" wrote: I am trying to set up a macro in a workbook so that when I run the macro the file will Save As and prompt for a new file name. I would like to have the old file name show in the box as I only need to change a few caracters. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save As
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean) Dim filesavename as Variant filesavename = Application.GetSaveAsFilename( _ ThisWorkbook.Filename, _ fileFilter:="Microsoft Excel Workbook (*.xls),*.xls") If filesavename < False Then Application.EnableEvents = False if lcase(thisworkbook.fullname) = lcase(filesavename) then thisworkbook.Save else on Error resume Next kill filesavename on Error goto 0 thisworkbook.SaveAs filesavename end if End If Application.EnableEvents = True Cancel = True end sub Put this in the ThisWorkbook module of each workbook. In you code refer to the book containing the code as thisworkbook, and you won't need the name. for the workbook with the focus, use ActiveWorkbook. -- Regards, Tom Ogilvy "kdreyer" wrote in message ... I also need to switch back and forth between two workbooks with this same macro. After I have specified the file name is there any way that the rest of the macro will be able to call the workbook with the new name. "kdreyer" wrote: I am trying to set up a macro in a workbook so that when I run the macro the file will Save As and prompt for a new file name. I would like to have the old file name show in the box as I only need to change a few caracters. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Save, save as, page setup dimmed out in unprotected excel sheet? | Excel Discussion (Misc queries) | |||
Save As and save current numbers not the actual formulas and links | Excel Discussion (Misc queries) | |||
Command Button Save As Application.ExecuteExcel4Macro ("SAVE.AS?() | Excel Discussion (Misc queries) | |||
when i save xls file, debug script is running and canno't save fil | Excel Discussion (Misc queries) | |||
Save As - Multiple Sheets fails to save as text file | Excel Programming |