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.




Reply With Quote