|
-
Apr 5th, 2004, 07:31 PM
#1
Thread Starter
Lively Member
Excel 97 - What the? Printpreview
Sorry about posting this again, but I just stumbled on the weirdest thing. Can anyone explain to me the difference between these two subroutines? Or why the first one works and the second one doesn't.
VB Code:
Sub printsheet()
Dim RngSelectedPrint As Range
Set RngSelectedPrint = Worksheets(1).Range("A1:d20")
RngSelectedPrint.PrintPreview 'enablechanges:=False
Worksheets.PrintPreview enablechanges:=False
End Sub
VB Code:
Sub printsheet2()
Dim RngSelectedPrint As Range
Set RngSelectedPrint = Worksheets(1).Range("A1:d20")
RngSelectedPrint.PrintPreview enablechanges:=False
Worksheets.PrintPreview enablechanges:=False
End Sub
"print preview method of range class failed" ? what the?
At first I thought this was an error caused the version of Excel I was in. Turned out to be a coding issue.
And yes - I know I have two back to back print preview statements. It's to show the diff between accessing from a worksheet and a defined range.
-----
#VBA, VB 6 Professional Edition, Office XP Developper. Excel 97, Excel 2000, Excel XP
I miss my VIC 20.
Never should have upgraded to my commodore 64. ...
-
Apr 6th, 2004, 04:03 AM
#2
Addicted Member
FWIW I use XL97 and can reproduce the fault.
Regards
BrianB
-------------------------------
-
Apr 6th, 2004, 08:59 PM
#3
Thread Starter
Lively Member
I tried it on three machines, using XL97 and XP and got the same error result.
It is a result of the following code:
RngSelectedPrint.PrintPreview enablechanges:=False
which works, if you omit the enable changes parameter.
Using the worksheet as the object, the parameter works fine,
Worksheets.PrintPreview enablechanges:=False
Still would like to know if anyone else but me is getting this same result, and what a work-around or fix could be. I want to gain access to the enable changes parameter, but I also need to specify a certain range area, not the total worksheet.
-----
#VBA, VB 6 Professional Edition, Office XP Developper. Excel 97, Excel 2000, Excel XP
I miss my VIC 20.
Never should have upgraded to my commodore 64. ...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|