Debug.Print in a WITH procedure?

  • Thread starter Thread starter Toby Erkson
  • Start date Start date
T

Toby Erkson

I am creating a subroutine to dump pivot table info into the Immediate window
using Debug.Print. I would like to use the WITH procedure...how do I do it?
I'm not too familiar with the intricacies of the WITH syntax.

This is what I'm looking for:
If ShowMeAll Then
Debug.Print
With WSheet.PivotTables(iIndex).PivotCache
"BackgroundQuery=" & .BackgroundQuery & "; "
"EnableRefresh= " & .EnableRefresh
End With
End If

Thus the output I would see would be:
BackgroundQuery= False; EnableRefresh = True

My output will actually be bigger as I'll be pulling more PivotCache info but
if I can just get the beginning started...
Thanks!
 
You need a Debug.Print statement on every line that is to be
printed to the Immediate window.

With WSheet.PivotTables(iIndex).PivotCache
Debug.Print "BackgroundQuery=" &
..BackgroundQuery & "; "
Debug.Print "EnableRefresh= " & .EnableRefresh
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
It should be:

If ShowMeAll Then
With WSheet.PivotTables(iIndex).PivotCache
Debug.Print "BackgroundQuery=" & .BackgroundQuery & "; "
Debug.Print "EnableRefresh= " & .EnableRefresh
End With
End If
 
Rats, that's what I was thinking I'd have to do. No problem though, thx!
 
More to what I wanted (before gobs of errors cropped up with the additional
items I inserted):

If ShowMeAll Then
With WSheet.PivotTables(iIndex).PivotCache
Debug.Print "BackgroundQuery=" & .BackgroundQuery & "; " _
& "EnableRefresh= " & .EnableRefresh
End With
End If

Thanks for the help! I'm well on my way :-)
Toby
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top