Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 32
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 32
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default 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



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 32
Default 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

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to code on Macro on saving and closing a file? Eric Excel Worksheet Functions 1 June 10th 07 01:32 PM
Saving a copy of excel file in macro but have it auto write pano Excel Worksheet Functions 4 March 27th 07 11:54 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
Saving a text file macro jknapp1005 Excel Discussion (Misc queries) 2 September 5th 06 08:01 PM
Macro Help for Saving a file [email protected] Excel Worksheet Functions 3 May 12th 06 05:16 PM


All times are GMT +1. The time now is 08:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"