0

I have the following code which works, but throws a

"Run-time '1004' Unable to set the Printout property of the worksheet class"

Here's the code:

Sub PrintOutv1()

'PrintOutv1 Macro
Dim Val As Double
Val = ActiveWorkbook.Sheets("WU").Range("E1").Value
ActiveWorkbook.Sheets("WU").PrintOut(1, Val, 1, True) = True
Oli Folkerd
  • 7,510
  • 1
  • 22
  • 46
AJ Bomber
  • 3
  • 3

1 Answers1

0

Parentheses bite again! Drop the parentheses around the arguments and don't attempt to assign a value:

Dim myVal As Double '<~ avoid confusion with the Val function
myVal = ActiveWorkbook.Sheets("WU").Range("E1").Value

ActiveWorkbook.Sheets("WU").PrintOut 1, myVal, 1, True
BigBen
  • 46,229
  • 7
  • 24
  • 40
  • https://stackoverflow.com/questions/5413765/what-are-the-rules-governing-usage-of-brackets-in-vba-function-calls – BigBen Aug 19 '20 at 19:06