Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-20-2022, 05:48 PM
Jerry In Houston Jerry In Houston is offline Error 4120 when using a printing macro Windows 11 Error 4120 when using a printing macro Office 2016
Novice
Error 4120 when using a printing macro
 
Join Date: Jan 2022
Location: Texas
Posts: 3
Jerry In Houston is on a distinguished road
Question Error 4120 when using a printing macro

I use a macro to print several multi page documents. My printer will not do what I want it to do so my macro prints the document one page at a time: Here is a bit of the code;
Selection.GoTo What:=wdGoToPage, Which:=1
The print routine
Selection.GoTo What:=wdGoToPage, Which:=2


The print routine
Selection.GoTo What:=wdGoToPage, Which:=3
The print routine
Selection.GoTo What:=wdGoToPage, Which:=4 ==== The error occurs
I get an error 4120 Bad Prameter
All of these documents are over 30 pages long so there is a page 4. I have used a counting loop for the “Which:=” number but is still throws the error when the value = 4.

Any Help??
Reply With Quote
  #2  
Old 01-21-2022, 04:41 AM
rollis13's Avatar
rollis13 rollis13 is offline Error 4120 when using a printing macro Windows 10 Error 4120 when using a printing macro Office 2016
Competent Performer
 
Join Date: Jan 2021
Location: Cordenons
Posts: 140
rollis13 will become famous soon enough
Default

No sure what your 'print routine' does but maybe if you use a counting loop (on the x) within this code you could get the job done:
Code:
Selection.GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=x
Reply With Quote
  #3  
Old 01-21-2022, 10:06 AM
Jerry In Houston Jerry In Houston is offline Error 4120 when using a printing macro Windows 11 Error 4120 when using a printing macro Office 2016
Novice
Error 4120 when using a printing macro
 
Join Date: Jan 2022
Location: Texas
Posts: 3
Jerry In Houston is on a distinguished road
Smile

I will try this presently I have a loop:
Do Until NextPage > TotalPages
Selection.GoTo What:=wdGoToPage, Which:=NextPage
Print Routine
Loop
However, your code:
Selection.GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=x
Looks like a good idea.

Thanks for the response much appreciated.
Reply With Quote
  #4  
Old 01-21-2022, 10:42 AM
Jerry In Houston Jerry In Houston is offline Error 4120 when using a printing macro Windows 11 Error 4120 when using a printing macro Office 2016
Novice
Error 4120 when using a printing macro
 
Join Date: Jan 2022
Location: Texas
Posts: 3
Jerry In Houston is on a distinguished road
Thumbs up It worked

Yep! it worked. Once again thanks.
Reply With Quote
  #5  
Old 01-21-2022, 10:59 AM
rollis13's Avatar
rollis13 rollis13 is offline Error 4120 when using a printing macro Windows 10 Error 4120 when using a printing macro Office 2016
Competent Performer
 
Join Date: Jan 2021
Location: Cordenons
Posts: 140
rollis13 will become famous soon enough
Default

Thanks for the feedback, glad having been of some help.
Reply With Quote
Reply

Tags
error 4120 when pprinting

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Word template with Macro keeps getting an error ''Run-time error 5941'' Marcel Word VBA 3 12-17-2019 04:55 PM
Error 4120 when using a printing macro Insufficient memory error when printing to a macro Rockystock Word VBA 8 10-21-2016 07:43 AM
Error 4120 when using a printing macro Runtime Error 4120 in Word 2007 macro Frankwlc Word 5 11-28-2011 01:54 AM
Error in printing callkalpa Word 0 09-21-2010 07:35 PM
Error message when printing e-mails nolson Outlook 0 01-02-2006 09:50 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:23 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft