ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   File Naming (https://www.excelbanter.com/excel-programming/385962-file-naming.html)

bodhisatvaofboogie

File Naming
 
I wish to have a macro save a file name as a value within a cell. I'm not
sure where to go with this.

I figured I could select the range and set it as MyValue, then use the
savecopy as method, but I can't figure out how to get the MyValue in there as
the file name...

MyValue = Range("A1").Value
ActiveWorkbook.SaveCopyAs "C:\Documents and Settings\Desktop\MyValue.xls"

this is where I can't figure out how to get the MyValue in there as the
filename. If I put it like this, the file is saved as MyValue.xls
literally, and I want it to be the actual value within that range... Any
ideas? Thanks!!!

Don Guillett

File Naming
 
try
MyValue = Range("A1") & ".xls"
ActiveWorkbook.SaveCopyAs "C:\Documents and Settings\Desktop\" & myvalue


--
Don Guillett
SalesAid Software

"bodhisatvaofboogie" wrote in
message ...
I wish to have a macro save a file name as a value within a cell. I'm not
sure where to go with this.

I figured I could select the range and set it as MyValue, then use the
savecopy as method, but I can't figure out how to get the MyValue in there
as
the file name...

MyValue = Range("A1").Value
ActiveWorkbook.SaveCopyAs "C:\Documents and Settings\Desktop\MyValue.xls"

this is where I can't figure out how to get the MyValue in there as the
filename. If I put it like this, the file is saved as MyValue.xls
literally, and I want it to be the actual value within that range... Any
ideas? Thanks!!!




JLGWhiz

File Naming
 
Maybe this:

MyValue = Range("A1").Value
ActiveWorkbook.SaveCopyAs "C:\Documents and Settings\Desktop\" & MyValue &
".xls"


"bodhisatvaofboogie" wrote:

I wish to have a macro save a file name as a value within a cell. I'm not
sure where to go with this.

I figured I could select the range and set it as MyValue, then use the
savecopy as method, but I can't figure out how to get the MyValue in there as
the file name...

MyValue = Range("A1").Value
ActiveWorkbook.SaveCopyAs "C:\Documents and Settings\Desktop\MyValue.xls"

this is where I can't figure out how to get the MyValue in there as the
filename. If I put it like this, the file is saved as MyValue.xls
literally, and I want it to be the actual value within that range... Any
ideas? Thanks!!!



All times are GMT +1. The time now is 10:39 AM.

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