View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rodby Rodby is offline
external usenet poster
 
Posts: 8
Default Novice question: I cannot get the immediate window to work

I am trying to learn VBA from a STEP BY STEP written by Reed Jacobson.
He encourages using the Immediate Window because he claims you can see the
progress as you code.
I am copying his code verbatim. For example, in the current practice, I have
the following Macro shell;

Sub PivotSet Style()
Dim pt as Pivottable
Dim ts as Tablestyle
Set pt=ActiveCell.Pivottable
End sub

I initialize this by pressing F8 three times, and then I type the following
in the immediate window:
Set
ts=ActiveWorkbook.Tablestyles("PivotStyleDark2").D uplicate("NewPivotStyle")
pt.Tablestyle2=ts.Name

(Note: the "Set ts= ActiveWorkbook..." statement above, is all on one line
in the immediate window)

When I get to the last line I get an "Object Required" error message.

I've checked the code and the instructions, and I cannot see anything
different from what I have copied.

What am I doing wrong?