Word VBA PrintOut Method

Method doesn't seem to like my variable

Page 1 of 1

1 Replies - 5682 Views - Last Post: 07 July 2009 - 07:00 AM Rate Topic: -----

#1 MajorWalrus   User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 115
  • Joined: 22-April 09

Word VBA PrintOut Method

Post icon  Posted 06 July 2009 - 02:43 PM

I'm trying to programmatically change the number of pages my users print when they click the "Print" button in my form. If I hard code a value the method works fine, but if I try to set it to a user-defined variable it ends up printing the entire document (178 pgs).

This works:
Activedocument.Activewindow.PrintOut _
Range:=wdPrintFromTo, From:="1", To:="5"



But this, where i_TotalTabs = 5, doesn't:
Activedocument.Activewindow.PrintOut _
Range:=wdPrintFromTo, From:="1", To:="i_TotalTabs"



I don't get any errors. Though, I tried removing the quotes around the From value, but then I get a type mismatch error.

Is This A Good Question/Topic? 0
  • +

Replies To: Word VBA PrintOut Method

#2 MajorWalrus   User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 115
  • Joined: 22-April 09

Re: Word VBA PrintOut Method

Posted 07 July 2009 - 07:00 AM

NM. I figured it out. The variable has to be a string, for whatever reason, add I was using an integer.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1