ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SaveAs syntax when using a variable (https://www.excelbanter.com/excel-programming/281460-saveas-syntax-when-using-variable.html)

keith

SaveAs syntax when using a variable
 
I need to save a file as read-only recommended. My file
name is stored in a variable, strSaveFile.

I can't get the SaveAs method to work correctly.

What I have:

exlSheet.SaveAs(strSaveFile,,,,True,,,,)
- True for read-only recommended.

This give me a compiler error.

What is the correct syntax?

Thanks

stef

SaveAs syntax when using a variable
 
try this one...

exlSheet.SaveAs strSaveFile, , , , True


should work


-----Original Message-----
I need to save a file as read-only recommended. My file
name is stored in a variable, strSaveFile.

I can't get the SaveAs method to work correctly.

What I have:

exlSheet.SaveAs(strSaveFile,,,,True,,,,)
- True for read-only recommended.

This give me a compiler error.

What is the correct syntax?

Thanks
.


Trevor Shuttleworth

SaveAs syntax when using a variable
 
Keith

lose the brackets:

exlSheet.SaveAs strSaveFile, , , , True

Note though that Save and SaveAs relate to the workbook rather than a
worksheet. Your object gives the impression that you might be trying to
save a sheet. Just something to bear in mind.

Regards

Trevor


"Keith" wrote in message
...
I need to save a file as read-only recommended. My file
name is stored in a variable, strSaveFile.

I can't get the SaveAs method to work correctly.

What I have:

exlSheet.SaveAs(strSaveFile,,,,True,,,,)
- True for read-only recommended.

This give me a compiler error.

What is the correct syntax?

Thanks




Nigel[_5_]

SaveAs syntax when using a variable
 

Keith,
Try this......

ActiveWorkbook.SaveAs Filename:=strSaveFile, ReadOnlyRecommended:=False


"Keith" wrote in message
...
I need to save a file as read-only recommended. My file
name is stored in a variable, strSaveFile.

I can't get the SaveAs method to work correctly.

What I have:

exlSheet.SaveAs(strSaveFile,,,,True,,,,)
- True for read-only recommended.

This give me a compiler error.

What is the correct syntax?

Thanks





----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---


All times are GMT +1. The time now is 01:34 PM.

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