Discussion Locked

Recorded VB Macro gives error when run

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Using Word XP as the email editor in Outlook XP, we
recorded 2 macros to be able to print emails to 1 of 2
printers. These macros work fine in Word, and also when
composing a new email, but will not work in a received
email. The error response is "Run-time error 438. Object
doesn't support this property or method", with the
debugger referring to Application.Printout

Any ideas?

The macros are:
Sub Brother()
'
' Brother Macro
' Macro recorded 10/28/2003 by Mark James
'
ActivePrinter = "\\Compaq\Brother HL-10h"
Application.PrintOut FileName:="",
Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True,
Background:=True, PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0,
PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
End Sub
Sub Epson()
'
' Epson Macro
' Macro recorded 10/28/2003 by Mark James
'
ActivePrinter = "\\compaq\EPSON Stylus COLOR 760"
Application.PrintOut FileName:="",
Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True,
Background:=True, PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0,
PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
End Sub

Any thoughts appreciated!
MJ

2 replies

by d_gilmour_1978

That macro won't work in outlook it works for new messages as they are actually in word. Looking at the object model for outlook should shed some light on the matter. If you are still having issues re-post and I'll try to write the code for you

by steve_james

Thanks for your comments David, but sorry, don't know enough about Outlook/VBA Objects to make use of your reply. The Ms Outlook Objects in MsVB Project 1 shows ThisOutlookSession, but the right pane is blank.

This discussion is closed to new replies.