Saving a file using a variable as a name


Posted by Steve D on May 16, 2001 9:25 AM

This should be an easy one...
I have a variable that is the name of an open workbook: Current_File

I'm trying to save a copy by using the variable name, I know the below syntax is wrong:

ActiveWorkbook.SaveCopyAs "E:\Home\Tmp\Filename:=Current_File"

How do I get the file to save as the value of Current_File?

Thanks,
Steve

Posted by Barrie Davidson on May 16, 2001 9:28 AM

Try
Current_File = "E:\Home\Tmp\" & Current_File
ActiveWorkbook.SaveCopyAs(Current_File)

Barrie

Posted by Steve D on May 16, 2001 11:40 AM

Follow up question


Barrie,
Thanks for your help. This gets me closer but... the only problem is that that
Current_File = "E:\Home\file.xls"
So after the above code,
Current_File = "E:\Home\Tmp\E:\Home\file.xls"

My fault. I was not clear on the value of Current_File.

Does anyone have any ideas on how I can gab just the file.xls part?

Thanks,
Steve

Posted by Barrie Davidson on May 16, 2001 12:08 PM

Re: Follow up question

Steve, how are you setting the value of your variable Current_file? What is the syntax you are using?



Posted by Steve D on May 16, 2001 2:39 PM

Re: Follow up question


Thanks for all your help!
I just ended up writing a few Right and Left statements to capture what I needed.
Thank you for pointing me in the right direction!
Steve