ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto file naming with macro (https://www.excelbanter.com/excel-programming/425012-auto-file-naming-macro.html)

Matt G[_2_]

Auto file naming with macro
 
Hi,

I have a macro that rearranges the info in a file the way I want it. I
would to be able to save the updated file automatically using a static
beginning then adding a name part from within the worksheet. I don't want to
"SaveAs"; I want to overwrite the original file

For example: I want the file named "Account changes for 0XXX" where XXX
would be Left(C2, 3)

Any help is appreciated

ryguy7272

Auto file naming with macro
 
Can you get this to work?

Sub Macro1()
Dim SaveHere As Variant
SaveHere = Range("B2")
ActiveWorkbook.SaveAs Filename:= _
"C:\SaveHere.xls", FileFormat:=xlExcel8
End Sub


Regards,
Ryan---
--
RyGuy


"Matt G" wrote:

Hi,

I have a macro that rearranges the info in a file the way I want it. I
would to be able to save the updated file automatically using a static
beginning then adding a name part from within the worksheet. I don't want to
"SaveAs"; I want to overwrite the original file

For example: I want the file named "Account changes for 0XXX" where XXX
would be Left(C2, 3)

Any help is appreciated


Jacob Skaria

Auto file naming with macro
 
Hi Matt

Greetings. Please try the below code

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs "c:\Account changes for 0" & Left(Range("C2"), 3)
Application.DisplayAlerts = True

Cheers!!

"Matt G" wrote:

Hi,

I have a macro that rearranges the info in a file the way I want it. I
would to be able to save the updated file automatically using a static
beginning then adding a name part from within the worksheet. I don't want to
"SaveAs"; I want to overwrite the original file

For example: I want the file named "Account changes for 0XXX" where XXX
would be Left(C2, 3)

Any help is appreciated



All times are GMT +1. The time now is 01:20 AM.

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