View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Wayne Wayne is offline
external usenet poster
 
Posts: 133
Default Macro launch - Button vs Manual launch , has different results.

The following Macro behaves differently when manually started from the menu,
or when assigned to a Control button.
It does not work correctly when started from the button. It works OK from
the menu ( Tools;Macro;Macro <macro name Run)
The macro is supposed to create a adobe pdf file from a selected print
range. Using Excel 2000 , Adobe 6.0 Prof.
I have searched the trouble shooting section without sucess.
Can somebody help?

Sub Macro1()
Dim FILENAM
Sheets("Schedules").Select
ActiveSheet.PageSetup.PrintArea = "$A$230:$L$274"
Application.ActivePrinter = "Adobe PDF on Ne02:"
FILENAM = "C:\Test\mac1.pdf"
Application.SendKeys FILENAM, True
SendKeys "{Enter}"
SendKeys "Y"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"Adobe PDF on Ne02:"
Application.Wait (Now + TimeValue("0:00:01"))
Sheets("Notes").Select
End Sub