ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   change filename (https://www.excelbanter.com/excel-programming/421584-change-filename.html)

Rob

change filename
 
I am looking to some VBA script to change the filename BUT without saving at
that moment.

workbook.Saveas can be used but this also saves the file.

I would like to have the generated name displayed as default filename when
the user wants to saveas the excel sheet. (and not the name as it was opened
with)

regards

joel

change filename
 
You have to perform the saveas to get the window name to change. The best
way to do what you want is to open a dialog box using the GetSaveAsfilename
method and put the default name in as the Initialfilename. After the user
selects the filename, then do a SaveAS. Do this at the beginning of the
macro and then perform all your other operations and then do another Save at
the end of the changes.

application.GetSaveAsFilename(InitialFilename, FileFilter, FilterIndex,
Title, ButtonText)


"rob" wrote:

I am looking to some VBA script to change the filename BUT without saving at
that moment.

workbook.Saveas can be used but this also saves the file.

I would like to have the generated name displayed as default filename when
the user wants to saveas the excel sheet. (and not the name as it was opened
with)

regards


Rob

change filename
 
I just do not want the user interaction.

The filename is created based on the output of macro calculation.
But I do not want to save the file at this moment.

rob

"Joel" wrote:

You have to perform the saveas to get the window name to change. The best
way to do what you want is to open a dialog box using the GetSaveAsfilename
method and put the default name in as the Initialfilename. After the user
selects the filename, then do a SaveAS. Do this at the beginning of the
macro and then perform all your other operations and then do another Save at
the end of the changes.

application.GetSaveAsFilename(InitialFilename, FileFilter, FilterIndex,
Title, ButtonText)


"rob" wrote:

I am looking to some VBA script to change the filename BUT without saving at
that moment.

workbook.Saveas can be used but this also saves the file.

I would like to have the generated name displayed as default filename when
the user wants to saveas the excel sheet. (and not the name as it was opened
with)

regards



All times are GMT +1. The time now is 09:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com