ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SaveAs (https://www.excelbanter.com/excel-programming/282866-saveas.html)

Steve[_48_]

SaveAs
 
Hello,
I know that this is an easy question, and is perhaps due
to my Syntax (or at least that is the error I am getting).
I am trying to write a SaveAs function which would save
the Excel workbook using a reference to a cell. For
example, I would like to save the file as "***.xls", where
*** is the information contained in cell C4. So far I
have been trying to use the following, but it is not
working...

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\user\My documents\"
& "ActiveWorkbook.WorkSheet("Sheet1").Cells(3, 4)"
& ".xls",


Chip Pearson

SaveAs
 
Steve,

Get rid of the quotes in

"ActiveWorkbook.WorkSheet("Sheet1").Cells(3, 4)"

For example,

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\user\My documents\" & _
ActiveWorkbook.Worksheet("Sheet1").Cells(3, 4) & _
".xls"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Steve" wrote in message
...
Hello,
I know that this is an easy question, and is perhaps due
to my Syntax (or at least that is the error I am getting).
I am trying to write a SaveAs function which would save
the Excel workbook using a reference to a cell. For
example, I would like to save the file as "***.xls", where
*** is the information contained in cell C4. So far I
have been trying to use the following, but it is not
working...

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\user\My documents\"
& "ActiveWorkbook.WorkSheet("Sheet1").Cells(3, 4)"
& ".xls",




No Name

SaveAs
 
Hi,
This is still giving me syntax error. Is it possible to
show me the entire code, include the ActiveWorkbook
statement? I`ve seen another example here in the
newsgroup, but trying that also did not work...
Thank you,
Steve
-----Original Message-----
Hello,
I know that this is an easy question, and is perhaps due
to my Syntax (or at least that is the error I am

getting).
I am trying to write a SaveAs function which would save
the Excel workbook using a reference to a cell. For
example, I would like to save the file as "***.xls",

where
*** is the information contained in cell C4. So far I
have been trying to use the following, but it is not
working...

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\user\My documents\"
& "ActiveWorkbook.WorkSheet("Sheet1").Cells(3, 4)"
& ".xls",

.


tianzyul

答复: SaveAs
 
ActiveWorkbook.SaveAs "C:\Documents and Settings\user\My documents\" & "ActiveWorkbook.WorkSheet("Sheet1").Cells(3, 4)" & ".xls"


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

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