ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   File save macro error (https://www.excelbanter.com/excel-programming/387643-file-save-macro-error.html)

[email protected]

File save macro error
 
I am creating a macro that ends by saving the current file into a
directory specified by the user.

The user specifies the directory name thru the following command:

fldr = InputBox("Enter the 3 digit folder name")

Then, I am trying to use the following command to save the file into
the directory name that was just determined by the user.

Workbook.SaveAs ("C:\Documents and Settings\Administrator\My Documents\
$user\Hold\" & fldr & "\" & "Hold macro code.xls")

I keep getting a "Run time error 424" "Object required" error
message. I've verified that the path specified in my command is a
valid one. What is wrong with this command?

Thanks.


Vergel Adriano

File save macro error
 
If you're trying to save the currently active workbook, try:

ActiveWorkbook.SaveAs ("C:\Documents and Settings\Administrator\My Documents\
$user\Hold\" & fldr & "\" & "Hold macro code.xls")



--
Hope that helps.

Vergel Adriano


" wrote:

I am creating a macro that ends by saving the current file into a
directory specified by the user.

The user specifies the directory name thru the following command:

fldr = InputBox("Enter the 3 digit folder name")

Then, I am trying to use the following command to save the file into
the directory name that was just determined by the user.

Workbook.SaveAs ("C:\Documents and Settings\Administrator\My Documents\
$user\Hold\" & fldr & "\" & "Hold macro code.xls")

I keep getting a "Run time error 424" "Object required" error
message. I've verified that the path specified in my command is a
valid one. What is wrong with this command?

Thanks.




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

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