ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Saving a file while recording a macro (https://www.excelbanter.com/excel-discussion-misc-queries/156659-saving-file-while-recording-macro.html)

Richard Champlin

Saving a file while recording a macro
 
Once I have opened up a spreadsheet that I received in an e-mail, and
utilizing a macro to format it the way I want it, is it possible to then save
the worksheet in a particular location and with a standard name as the final
steps in the macro?
--
Richard Champlin
Administrative Program Assistant II
Children''''''''s Hospital & Regional Medical Center, Seattle

Gary''s Student

Saving a file while recording a macro
 
Just include lines like:

ChDir "C:\temp"
ActiveWorkbook.SaveAs Filename:="C:\temp\Book1.xls"
--
Gary''s Student - gsnu200741


"Richard Champlin" wrote:

Once I have opened up a spreadsheet that I received in an e-mail, and
utilizing a macro to format it the way I want it, is it possible to then save
the worksheet in a particular location and with a standard name as the final
steps in the macro?
--
Richard Champlin
Administrative Program Assistant II
Children''''''''s Hospital & Regional Medical Center, Seattle


Richard Champlin

Saving a file while recording a macro
 
I take it I could use any drive & folder designation (rather than "C:\temp")?

Is it possible to specify a filename that reflects the filename in the
attachment worksheet I received?

Thanks!
--
Richard Champlin
Administrative Program Assistant II
Children''''''''s Hospital & Regional Medical Center, Seattle


"Gary''s Student" wrote:

Just include lines like:

ChDir "C:\temp"
ActiveWorkbook.SaveAs Filename:="C:\temp\Book1.xls"
--
Gary''s Student - gsnu200741


"Richard Champlin" wrote:

Once I have opened up a spreadsheet that I received in an e-mail, and
utilizing a macro to format it the way I want it, is it possible to then save
the worksheet in a particular location and with a standard name as the final
steps in the macro?
--
Richard Champlin
Administrative Program Assistant II
Children''''''''s Hospital & Regional Medical Center, Seattle


Jim Thomlinson

Saving a file while recording a macro
 
For better or for worse my preference is to display the save as dialog. That
way you are in a well recognized postion to save your workbook in your
choosen directory with a proposed name that fits your general guidelines. It
also allows you to madify that at run time if you choose...

Application.Dialogs(xlDialogSaveAs).Show "C:\" & ActiveWorkbook.Name &
Format(Now, "yyyymmdd")

The above line of code will bring up the SaveAs dailog pointing at the Root
of C (you can change that) with the proposed name being the existing file
name with the Date appended to it.
--
HTH...

Jim Thomlinson


"Richard Champlin" wrote:

I take it I could use any drive & folder designation (rather than "C:\temp")?

Is it possible to specify a filename that reflects the filename in the
attachment worksheet I received?

Thanks!
--
Richard Champlin
Administrative Program Assistant II
Children''''''''s Hospital & Regional Medical Center, Seattle


"Gary''s Student" wrote:

Just include lines like:

ChDir "C:\temp"
ActiveWorkbook.SaveAs Filename:="C:\temp\Book1.xls"
--
Gary''s Student - gsnu200741


"Richard Champlin" wrote:

Once I have opened up a spreadsheet that I received in an e-mail, and
utilizing a macro to format it the way I want it, is it possible to then save
the worksheet in a particular location and with a standard name as the final
steps in the macro?
--
Richard Champlin
Administrative Program Assistant II
Children''''''''s Hospital & Regional Medical Center, Seattle


Gary''s Student

Saving a file while recording a macro
 
Yes - any drive - any folder

ChDir "C:\temp"
s = ActiveWorkbook.Name
ActiveWorkbook.SaveAs Filename:="C:\temp\" & s

This uses the same name as the file you get.
--
Gary''s Student - gsnu200741


"Richard Champlin" wrote:

I take it I could use any drive & folder designation (rather than "C:\temp")?

Is it possible to specify a filename that reflects the filename in the
attachment worksheet I received?

Thanks!
--
Richard Champlin
Administrative Program Assistant II
Children''''''''s Hospital & Regional Medical Center, Seattle


"Gary''s Student" wrote:

Just include lines like:

ChDir "C:\temp"
ActiveWorkbook.SaveAs Filename:="C:\temp\Book1.xls"
--
Gary''s Student - gsnu200741


"Richard Champlin" wrote:

Once I have opened up a spreadsheet that I received in an e-mail, and
utilizing a macro to format it the way I want it, is it possible to then save
the worksheet in a particular location and with a standard name as the final
steps in the macro?
--
Richard Champlin
Administrative Program Assistant II
Children''''''''s Hospital & Regional Medical Center, Seattle


Richard Champlin

Saving a file while recording a macro
 
I tried this, and wound up with an error message. I tried your first
suggestion, and it worked like a charm. But after I changed the code to
incorporate this one, and then tried to change it back, it gave me an error
message saying "path not found"...I tried to debug, and it highlighted the
first line of this code:

ChDir " O:\Open Purchase Orders\Cardinal POs\2007"
ActiveWorkbook.SaveAs Filename:=" O:\Open Purchase Orders\Cardinal
POs\2007\Latest Cardinal.xls"
End Sub

Where have I screwed up?
--
Richard Champlin
Administrative Program Assistant II
Children''''''''s Hospital & Regional Medical Center, Seattle


"Gary''s Student" wrote:

Yes - any drive - any folder

ChDir "C:\temp"
s = ActiveWorkbook.Name
ActiveWorkbook.SaveAs Filename:="C:\temp\" & s

This uses the same name as the file you get.
--
Gary''s Student - gsnu200741


"Richard Champlin" wrote:

I take it I could use any drive & folder designation (rather than "C:\temp")?

Is it possible to specify a filename that reflects the filename in the
attachment worksheet I received?

Thanks!
--
Richard Champlin
Administrative Program Assistant II
Children''''''''s Hospital & Regional Medical Center, Seattle


"Gary''s Student" wrote:

Just include lines like:

ChDir "C:\temp"
ActiveWorkbook.SaveAs Filename:="C:\temp\Book1.xls"
--
Gary''s Student - gsnu200741


"Richard Champlin" wrote:

Once I have opened up a spreadsheet that I received in an e-mail, and
utilizing a macro to format it the way I want it, is it possible to then save
the worksheet in a particular location and with a standard name as the final
steps in the macro?
--
Richard Champlin
Administrative Program Assistant II
Children''''''''s Hospital & Regional Medical Center, Seattle


Gary''s Student

Saving a file while recording a macro
 
I don't see an obvious error, but I can't duplicate you drive/folder structure
--
Gary''s Student - gsnu200741


"Richard Champlin" wrote:

I tried this, and wound up with an error message. I tried your first
suggestion, and it worked like a charm. But after I changed the code to
incorporate this one, and then tried to change it back, it gave me an error
message saying "path not found"...I tried to debug, and it highlighted the
first line of this code:

ChDir " O:\Open Purchase Orders\Cardinal POs\2007"
ActiveWorkbook.SaveAs Filename:=" O:\Open Purchase Orders\Cardinal
POs\2007\Latest Cardinal.xls"
End Sub

Where have I screwed up?
--
Richard Champlin
Administrative Program Assistant II
Children''''''''s Hospital & Regional Medical Center, Seattle


"Gary''s Student" wrote:

Yes - any drive - any folder

ChDir "C:\temp"
s = ActiveWorkbook.Name
ActiveWorkbook.SaveAs Filename:="C:\temp\" & s

This uses the same name as the file you get.
--
Gary''s Student - gsnu200741


"Richard Champlin" wrote:

I take it I could use any drive & folder designation (rather than "C:\temp")?

Is it possible to specify a filename that reflects the filename in the
attachment worksheet I received?

Thanks!
--
Richard Champlin
Administrative Program Assistant II
Children''''''''s Hospital & Regional Medical Center, Seattle


"Gary''s Student" wrote:

Just include lines like:

ChDir "C:\temp"
ActiveWorkbook.SaveAs Filename:="C:\temp\Book1.xls"
--
Gary''s Student - gsnu200741


"Richard Champlin" wrote:

Once I have opened up a spreadsheet that I received in an e-mail, and
utilizing a macro to format it the way I want it, is it possible to then save
the worksheet in a particular location and with a standard name as the final
steps in the macro?
--
Richard Champlin
Administrative Program Assistant II
Children''''''''s Hospital & Regional Medical Center, Seattle



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

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