PC Review


Reply
Thread Tools Rate Thread

Compile Error: With From:= << Highlighted

 
 
JMay
Guest
Posts: n/a
 
      6th Dec 2008
Sub PrintSkipP1()
Dim sht As Worksheet

For Each sht In ActiveWindow.SelectedSheets
sht.PrintPreview From:=2, To:=4
Next sht

Set sht = Nothing
End Sub

WHY?
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      6th Dec 2008
Hi,

As far as I'm aware the only switches for .printpreview are True/False and
the correct syntax is

sht.PrintPreview (True)

What are you attempting to do with the switch you are using?

Mike



"JMay" wrote:

> Sub PrintSkipP1()
> Dim sht As Worksheet
>
> For Each sht In ActiveWindow.SelectedSheets
> sht.PrintPreview From:=2, To:=4
> Next sht
>
> Set sht = Nothing
> End Sub
>
> WHY?

 
Reply With Quote
 
JMay
Guest
Posts: n/a
 
      6th Dec 2008
Thanks Mike,
Actually, I'm trying to create a Macro that will Skip the printing of my
Page 1 of my Active 4 page printout (print only 2,3 and 4). For testing I
always use the Preview option versus PrintOut (to save paper). Also - I
actually want the To:= to be To:=[Pages] representing print to the last
page (whatever number that is)...
Thanks,
Jim


"Mike H" wrote:

> Hi,
>
> As far as I'm aware the only switches for .printpreview are True/False and
> the correct syntax is
>
> sht.PrintPreview (True)
>
> What are you attempting to do with the switch you are using?
>
> Mike
>
>
>
> "JMay" wrote:
>
> > Sub PrintSkipP1()
> > Dim sht As Worksheet
> >
> > For Each sht In ActiveWindow.SelectedSheets
> > sht.PrintPreview From:=2, To:=4
> > Next sht
> >
> > Set sht = Nothing
> > End Sub
> >
> > WHY?

 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      6th Dec 2008
Hi,

I look to be corrected but I'm fairly sure you can only preview all pages.
printout is different you can do this

For Each sht In ActiveWindow.SelectedSheets
sht.Printout From:=2, To:=4
Next sht

Mike

"JMay" wrote:

> Thanks Mike,
> Actually, I'm trying to create a Macro that will Skip the printing of my
> Page 1 of my Active 4 page printout (print only 2,3 and 4). For testing I
> always use the Preview option versus PrintOut (to save paper). Also - I
> actually want the To:= to be To:=[Pages] representing print to the last
> page (whatever number that is)...
> Thanks,
> Jim
>
>
> "Mike H" wrote:
>
> > Hi,
> >
> > As far as I'm aware the only switches for .printpreview are True/False and
> > the correct syntax is
> >
> > sht.PrintPreview (True)
> >
> > What are you attempting to do with the switch you are using?
> >
> > Mike
> >
> >
> >
> > "JMay" wrote:
> >
> > > Sub PrintSkipP1()
> > > Dim sht As Worksheet
> > >
> > > For Each sht In ActiveWindow.SelectedSheets
> > > sht.PrintPreview From:=2, To:=4
> > > Next sht
> > >
> > > Set sht = Nothing
> > > End Sub
> > >
> > > WHY?

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      6th Dec 2008
..printout has a preview parm:

sht.PrintOut preview:=True, From:=2, To:=999

(make 999 as big as you want to ensure that you got all the pages.)

JMay wrote:
>
> Thanks Mike,
> Actually, I'm trying to create a Macro that will Skip the printing of my
> Page 1 of my Active 4 page printout (print only 2,3 and 4). For testing I
> always use the Preview option versus PrintOut (to save paper). Also - I
> actually want the To:= to be To:=[Pages] representing print to the last
> page (whatever number that is)...
> Thanks,
> Jim
>
> "Mike H" wrote:
>
> > Hi,
> >
> > As far as I'm aware the only switches for .printpreview are True/False and
> > the correct syntax is
> >
> > sht.PrintPreview (True)
> >
> > What are you attempting to do with the switch you are using?
> >
> > Mike
> >
> >
> >
> > "JMay" wrote:
> >
> > > Sub PrintSkipP1()
> > > Dim sht As Worksheet
> > >
> > > For Each sht In ActiveWindow.SelectedSheets
> > > sht.PrintPreview From:=2, To:=4
> > > Next sht
> > >
> > > Set sht = Nothing
> > > End Sub
> > >
> > > WHY?


--

Dave Peterson
 
Reply With Quote
 
JMay
Guest
Posts: n/a
 
      6th Dec 2008
Final Code (seems a shame that we have to refer to Excel4Macro.... it get it
to work -- Is there a more current substitute?)
Tks Mike

Sub PrintSkipP1()
Dim sht As Worksheet
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
For Each sht In ActiveWindow.SelectedSheets
sht.PrintOut From:=2, To:=TotPages
Next sht
Set sht = Nothing
End Sub

"Mike H" wrote:

> Hi,
>
> I look to be corrected but I'm fairly sure you can only preview all pages.
> printout is different you can do this
>
> For Each sht In ActiveWindow.SelectedSheets
> sht.Printout From:=2, To:=4
> Next sht
>
> Mike
>
> "JMay" wrote:
>
> > Thanks Mike,
> > Actually, I'm trying to create a Macro that will Skip the printing of my
> > Page 1 of my Active 4 page printout (print only 2,3 and 4). For testing I
> > always use the Preview option versus PrintOut (to save paper). Also - I
> > actually want the To:= to be To:=[Pages] representing print to the last
> > page (whatever number that is)...
> > Thanks,
> > Jim
> >
> >
> > "Mike H" wrote:
> >
> > > Hi,
> > >
> > > As far as I'm aware the only switches for .printpreview are True/False and
> > > the correct syntax is
> > >
> > > sht.PrintPreview (True)
> > >
> > > What are you attempting to do with the switch you are using?
> > >
> > > Mike
> > >
> > >
> > >
> > > "JMay" wrote:
> > >
> > > > Sub PrintSkipP1()
> > > > Dim sht As Worksheet
> > > >
> > > > For Each sht In ActiveWindow.SelectedSheets
> > > > sht.PrintPreview From:=2, To:=4
> > > > Next sht
> > > >
> > > > Set sht = Nothing
> > > > End Sub
> > > >
> > > > WHY?

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      6th Dec 2008
Hi Dave

>> (make 999 as big as you want to ensure that you got all the pages.)


I believe this part To:=999 is not needed if I remember correct ?

The OP can use
sht.PrintOut preview:=True, From:=2


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Dave Peterson" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> .printout has a preview parm:
>
> sht.PrintOut preview:=True, From:=2, To:=999
>
> (make 999 as big as you want to ensure that you got all the pages.)
>
> JMay wrote:
>>
>> Thanks Mike,
>> Actually, I'm trying to create a Macro that will Skip the printing of my
>> Page 1 of my Active 4 page printout (print only 2,3 and 4). For testing I
>> always use the Preview option versus PrintOut (to save paper). Also - I
>> actually want the To:= to be To:=[Pages] representing print to the last
>> page (whatever number that is)...
>> Thanks,
>> Jim
>>
>> "Mike H" wrote:
>>
>> > Hi,
>> >
>> > As far as I'm aware the only switches for .printpreview are True/False and
>> > the correct syntax is
>> >
>> > sht.PrintPreview (True)
>> >
>> > What are you attempting to do with the switch you are using?
>> >
>> > Mike
>> >
>> >
>> >
>> > "JMay" wrote:
>> >
>> > > Sub PrintSkipP1()
>> > > Dim sht As Worksheet
>> > >
>> > > For Each sht In ActiveWindow.SelectedSheets
>> > > sht.PrintPreview From:=2, To:=4
>> > > Next sht
>> > >
>> > > Set sht = Nothing
>> > > End Sub
>> > >
>> > > WHY?

>
> --
>
> Dave Peterson

 
Reply With Quote
 
JMay
Guest
Posts: n/a
 
      6th Dec 2008
Thanks Both Dave and Ron --
So my lastest code (see under last comm to Mike) with Q is solved
by "forgetting" the need for the To:= parameter?
Coooooooool !!!!!!!!!


"Ron de Bruin" wrote:

> Hi Dave
>
> >> (make 999 as big as you want to ensure that you got all the pages.)

>
> I believe this part To:=999 is not needed if I remember correct ?
>
> The OP can use
> sht.PrintOut preview:=True, From:=2
>
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl/tips.htm
>
>
> "Dave Peterson" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> > .printout has a preview parm:
> >
> > sht.PrintOut preview:=True, From:=2, To:=999
> >
> > (make 999 as big as you want to ensure that you got all the pages.)
> >
> > JMay wrote:
> >>
> >> Thanks Mike,
> >> Actually, I'm trying to create a Macro that will Skip the printing of my
> >> Page 1 of my Active 4 page printout (print only 2,3 and 4). For testing I
> >> always use the Preview option versus PrintOut (to save paper). Also - I
> >> actually want the To:= to be To:=[Pages] representing print to the last
> >> page (whatever number that is)...
> >> Thanks,
> >> Jim
> >>
> >> "Mike H" wrote:
> >>
> >> > Hi,
> >> >
> >> > As far as I'm aware the only switches for .printpreview are True/False and
> >> > the correct syntax is
> >> >
> >> > sht.PrintPreview (True)
> >> >
> >> > What are you attempting to do with the switch you are using?
> >> >
> >> > Mike
> >> >
> >> >
> >> >
> >> > "JMay" wrote:
> >> >
> >> > > Sub PrintSkipP1()
> >> > > Dim sht As Worksheet
> >> > >
> >> > > For Each sht In ActiveWindow.SelectedSheets
> >> > > sht.PrintPreview From:=2, To:=4
> >> > > Next sht
> >> > >
> >> > > Set sht = Nothing
> >> > > End Sub
> >> > >
> >> > > WHY?

> >
> > --
> >
> > Dave Peterson

>

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      6th Dec 2008
>Is there a more current substitute

Not that I know of
I also use it here
http://www.rondebruin.nl/print.htm#not

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"JMay" <(E-Mail Removed)> wrote in message newsE2DBC71-B4F5-4EB1-8AA0-(E-Mail Removed)...
> Final Code (seems a shame that we have to refer to Excel4Macro.... it get it
> to work -- Is there a more current substitute?)
> Tks Mike
>
> Sub PrintSkipP1()
> Dim sht As Worksheet
> TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
> For Each sht In ActiveWindow.SelectedSheets
> sht.PrintOut From:=2, To:=TotPages
> Next sht
> Set sht = Nothing
> End Sub
>
> "Mike H" wrote:
>
>> Hi,
>>
>> I look to be corrected but I'm fairly sure you can only preview all pages.
>> printout is different you can do this
>>
>> For Each sht In ActiveWindow.SelectedSheets
>> sht.Printout From:=2, To:=4
>> Next sht
>>
>> Mike
>>
>> "JMay" wrote:
>>
>> > Thanks Mike,
>> > Actually, I'm trying to create a Macro that will Skip the printing of my
>> > Page 1 of my Active 4 page printout (print only 2,3 and 4). For testing I
>> > always use the Preview option versus PrintOut (to save paper). Also - I
>> > actually want the To:= to be To:=[Pages] representing print to the last
>> > page (whatever number that is)...
>> > Thanks,
>> > Jim
>> >
>> >
>> > "Mike H" wrote:
>> >
>> > > Hi,
>> > >
>> > > As far as I'm aware the only switches for .printpreview are True/False and
>> > > the correct syntax is
>> > >
>> > > sht.PrintPreview (True)
>> > >
>> > > What are you attempting to do with the switch you are using?
>> > >
>> > > Mike
>> > >
>> > >
>> > >
>> > > "JMay" wrote:
>> > >
>> > > > Sub PrintSkipP1()
>> > > > Dim sht As Worksheet
>> > > >
>> > > > For Each sht In ActiveWindow.SelectedSheets
>> > > > sht.PrintPreview From:=2, To:=4
>> > > > Next sht
>> > > >
>> > > > Set sht = Nothing
>> > > > End Sub
>> > > >
>> > > > WHY?

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      6th Dec 2008
And if you use .printout and add preview:=true, you'll be able to printpreview,
too.

JMay wrote:
>
> Thanks Both Dave and Ron --
> So my lastest code (see under last comm to Mike) with Q is solved
> by "forgetting" the need for the To:= parameter?
> Coooooooool !!!!!!!!!
>
> "Ron de Bruin" wrote:
>
> > Hi Dave
> >
> > >> (make 999 as big as you want to ensure that you got all the pages.)

> >
> > I believe this part To:=999 is not needed if I remember correct ?
> >
> > The OP can use
> > sht.PrintOut preview:=True, From:=2
> >
> >
> > --
> >
> > Regards Ron de Bruin
> > http://www.rondebruin.nl/tips.htm
> >
> >
> > "Dave Peterson" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> > > .printout has a preview parm:
> > >
> > > sht.PrintOut preview:=True, From:=2, To:=999
> > >
> > > (make 999 as big as you want to ensure that you got all the pages.)
> > >
> > > JMay wrote:
> > >>
> > >> Thanks Mike,
> > >> Actually, I'm trying to create a Macro that will Skip the printing of my
> > >> Page 1 of my Active 4 page printout (print only 2,3 and 4). For testing I
> > >> always use the Preview option versus PrintOut (to save paper). Also - I
> > >> actually want the To:= to be To:=[Pages] representing print to the last
> > >> page (whatever number that is)...
> > >> Thanks,
> > >> Jim
> > >>
> > >> "Mike H" wrote:
> > >>
> > >> > Hi,
> > >> >
> > >> > As far as I'm aware the only switches for .printpreview are True/False and
> > >> > the correct syntax is
> > >> >
> > >> > sht.PrintPreview (True)
> > >> >
> > >> > What are you attempting to do with the switch you are using?
> > >> >
> > >> > Mike
> > >> >
> > >> >
> > >> >
> > >> > "JMay" wrote:
> > >> >
> > >> > > Sub PrintSkipP1()
> > >> > > Dim sht As Worksheet
> > >> > >
> > >> > > For Each sht In ActiveWindow.SelectedSheets
> > >> > > sht.PrintPreview From:=2, To:=4
> > >> > > Next sht
> > >> > >
> > >> > > Set sht = Nothing
> > >> > > End Sub
> > >> > >
> > >> > > WHY?
> > >
> > > --
> > >
> > > Dave Peterson

> >


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Export report to Excel, Error message "Compile Error: Argument not mc Microsoft Access External Data 0 16th Jul 2009 09:11 PM
excel 2003 - error in starting the program compile error in AutoExecNew Sam Microsoft Excel Misc 3 13th Feb 2006 03:27 PM
VBAProject name compile error, not defined at compile time Matthew Dodds Microsoft Excel Programming 1 13th Dec 2005 07:17 PM
cells highlighted and unable to remove highlighted debbie Microsoft Excel Worksheet Functions 1 3rd Oct 2004 05:48 AM
Highlighted words won't stay highlighted killme Windows XP Help 0 12th Dec 2003 12:31 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:10 PM.