View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
sakung sakung is offline
external usenet poster
 
Posts: 1
Default want to save, print and close wb


i'm new in VBE and need some advice on my work. I would like to sav
invoice to another name and print that new workbook and then close i
by using macro.

On my code, run the Save As command to create a new copy
of the Workbook(pentagon0002.xls), then don't open up that workbook
just close it.
that will give me the error "Object Required". What else I need t
fix?


Sub SaveandPrintout()

ActiveWindows.SelectSheets.PrintOut Copies:=1, Collate:=True

FileNum = ThisWorkbook.Sheets("Invoice").[B2].Value
FileNumStr = Format(FileNum, "0000")
ActiveWorkbook.SaveAs Filename:="c:\temp\test\pentagon" & FileNumStr
".xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

ActiveWindows.Close SaveChanges:=False

End Su

--
sakun
-----------------------------------------------------------------------
sakung's Profile: http://www.excelforum.com/member.php...fo&userid=3723
View this thread: http://www.excelforum.com/showthread.php?threadid=57062