word 2002 vba the margins of section 1 are set outside

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15641
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

word 2002 vba the margins of section 1 are set outside

Post by ChrisGreaves »

Can anyone suggest a reason why "Application.DisplayAlerts" would not work in Word 2002?

Code: Select all

Sub Print_DUCA()
    Application.DisplayAlerts = wdAlertsNone
    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
    Application.DisplayAlerts = wdAlertsAll
End Sub
The little macro is unchanged from the recording in Word 2002.
I bracketed it with the "Application.DisplayAlerts" anticipating that the pop-up box (below) would not appear, but I still get the (annoying) message.
The document (an envelope) prints correctly when I respond "yes" to the pop-up box.

I have used "Application.DisplayAlerts" with success in Excel 2000, but can't recall if I used it in Word 2000".
The Word 2002 VBA help example is quite clear; it says it should work.
20.png
You do not have the required permissions to view the files attached to this post.
He who plants a seed, plants life.

User avatar
HansV
Administrator
Posts: 78549
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: word 2002 vba the margins of section 1 are set outside

Post by HansV »

Setting DisplayAlerts = False should certainly suppress the error message.
Select Tools | Options... in the Visual Basic Editor.
Activate the General tab.
Make sure that "Break on Unhandled Errors" is selected in the Error Trapping section, not "Break on All Errors".
Best wishes,
Hans

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15641
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: word 2002 vba the margins of section 1 are set outside

Post by ChrisGreaves »

HansV wrote:"Break on Unhandled Errors"
Thanks Hans.

V. Strange. I didn't get around to seeing this until this morning, and then I fired up the program and did one more test run on the macro - it still balks at the margin error.
Then I went to change options and found that the settings are already correct.
I think I have a weird Win7/Office2002 system here.
40.png
You do not have the required permissions to view the files attached to this post.
He who plants a seed, plants life.

User avatar
HansV
Administrator
Posts: 78549
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: word 2002 vba the margins of section 1 are set outside

Post by HansV »

It's certainly strange.
Best wishes,
Hans

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15641
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: word 2002 vba the margins of section 1 are set outside

Post by ChrisGreaves »

HansV wrote:It's certainly strange.
... and dangerous.
Now that Networked Print job shows , “Printing”, but won’t print is solved, I set to work printing envelopes for my Christmas Cards.
On the 64-bit notebook LapC I fired up my Word 2003 application template, created an envelope, chose File, Print, selected the networked printer (on the 32-bit Netbook "LapA"), and told it to go ahead.
To my surprise, it did!
Without the cautionary prompt "The margins are set outside ...".
Huh?

Inexplicable - a HP2600N Color LaserJet printer is a HP2600N Color LaserJet printer , right? Even if it is across the network, and isn't Windows supposed to know everything about it?

"Dangerous" because I've gotten into the habit of choosing OK on the Fileprint dialogue box knowing that I am still an extra click away from printing, which gives me time to get off my chair and pop an envelope in the manual feed tray.
Not any more!
He who plants a seed, plants life.