ExecuteExcel4Macro syntax

Goldfish31415

New Member
Joined
Jun 18, 2011
Messages
1
Hi everybody,

If somebody could give me some guidance here, it would be much much appreciated.
Quite new to VBA and trying to create a macro (assigned to a button) that expands and collapses the first column of a pivot table. And have been trying for 2 hours now :(

So far, I just used the recorder and got: (note am using Mac Excel 2011)

Sub collapse()
Worksheets("renovaties pivot").Select
Range("B8").Select
ExecuteExcel4Macro "(""PivotTable1"",""categorie"",FALSE)"
End Sub

But when running the macro -> doesn't work
I then searched forums etc for some guidance and read that you need to specify the full name of the file with the 'ExecuteExcel4Macro' so I tried

ExecuteExcel4Macro "(""Workbooks(""immo investering_16.xlsm"").Worksheets(""renovaties pivot"").PivotTables(""PivotTable1"")"",""categorie"",FALSE)"

but doesn't work either, did I just get lost in the forest of brackets?

tanx a million already
Philip
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,224,603
Messages
6,179,849
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top