Power Pivot - How to get ModelMeasureNames Collection (or Calculated Fields Manager) of model using Excel/VBA

VladimirV

New Member
Joined
May 6, 2016
Messages
7
Hello everybody,

I have a trouble with getting ModelMeasureNames collection of Power Pivot model by using Excel/VBA. I can't find any function that would allow me to do this. I can get the Power Pivot model of the workbook by ActiveWorkbook.model. But this model object does not have any function that would allow me to get ModelMeasuresNames collection. The only thing I find is that there is workbook event "Private Sub Workbook_ModelChange(ByVal Changes As ModelChanges)" and the variable Changes allows me to get the ModelMeasureNames collection by Changes.MeasuresAdded. But this is not relevant to me as I am not catching events. I am using Excel 2013. Any help and suggestions are very appreciated.

Best regards,
Vladimir
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hello anvg,

Thanks a lot for your reply. Unfortunately, this does not work to me. Here is my code:
Set PPmodel = ActiveWorkbook.model
MsgBox PPmodel.Modelmeasures.Item(1).Name
And there is an error on the second line. Moreover, I can't understand, why in the ActiveWorkbook.model the word "model" starts with lower case (it is set automatically for me even if I try to write "model" with upper case). And when I write PPmodel. I do not have any suggestions to choose property "ModelMeasures" (but I see such properties as ModelTables, ModelRelationships).

Thank again!

Best regards,
Vladimir
 
Upvote 0
Hi, Vladimir.
I am sorry. Maybe reinstall your Excel 2013? Manually does Powerpivot work (calculates measures, shows tables)?
Regards,
 
Upvote 0
Hi, Anvg,

Thanks, I will try to do it. Manually Powerpivot works fine. I can create my measures (calculated fields) and use them in power pivot tables.

Best wishes,
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,858
Members
449,051
Latest member
excelquestion515

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