Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to save file and print document

ok, I need a to try to make a macro to save the active worksheet to m
C: drive with THE filename, (A3) SALES ORDERS

more specifically I need to have it save the filename as the content
of cell A3 then SALES ORDERS

Then I need it to print to worksheet.

How do I do this?

Thanks in advanc

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Macro to save file and print document

Sub SaveAs()
Dim rngA3

rngA3 = Sheet1.Range("A3").Value
ChDir "C:\"
ActiveWorkbook.SaveAs Filename:="C:\" & rngA3 & " Sales orders.xls",
FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

Modify sheet name and directory folders as needed.
Hope this gets you started, Mike
"abxy " wrote in message
...
ok, I need a to try to make a macro to save the active worksheet to my
C: drive with THE filename, (A3) SALES ORDERS

more specifically I need to have it save the filename as the contents
of cell A3 then SALES ORDERS

Then I need it to print to worksheet.

How do I do this?

Thanks in advance


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Macro to save file and print document

this will handle a date and text or numbers: changes 1/13/2004 to 1_13_2004

Sub SaveAs()
Dim rngA3

rngA3 = Sheet1.Range("A3").Value
If IsDate(rngA3) = True Then
rngA3 = Replace(rngA3, "/", "_")
End If
ChDir "C:\"
ActiveWorkbook.SaveAs Filename:="C:\" & rngA3 & " Sales orders.xls", _
FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

"abxy " wrote in message
...
What if cell A3 is date? because excel isn't letting me save the file
because of cell's date separators(/), I've tried changing the format of
the date in the cell, but Excel still interprets the date with /
symbols, so i can't save it, becuase windows thinks the /'s are part of
a path name


---
Message posted from http://www.ExcelForum.com/



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
Macro to automatically save document with cell reference as filena Erich Excel Discussion (Misc queries) 2 November 17th 09 02:47 PM
is it possible to save xls file to a word document like an attachm weit Excel Discussion (Misc queries) 2 February 22nd 06 06:57 PM
'document not saved' for 'save' or 'save as' an EXCEL file Judy Chuang Excel Discussion (Misc queries) 1 July 11th 05 10:12 PM
Print Excel to Microsoft Document Image File (MDI) David Nelson Excel Discussion (Misc queries) 1 April 1st 05 02:28 AM
FILE Save As / FILE Print greyed out in Excel Jeff Wright Excel Programming 2 September 3rd 03 09:29 AM


All times are GMT +1. The time now is 06:32 AM.

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

About Us

"It's about Microsoft Excel"