VBA changing Power Pivot column names?

macfuller

Active Member
Joined
Apr 30, 2014
Messages
319
Office Version
  1. 365
Platform
  1. Windows
VBA Code:
Dim objModelMeasures As ModelMeasures, objModelTable As ModelTable, objModelCol As ModelTableColumn
    For Each objModelTable In ActiveWorkbook.Model.ModelTables
                For Each objModelCol In objModelTable.ModelTableColumns
                    bIsFound = False
                    tbl.Range.Cells(iRow%, 1).Value = objModelTable.name
                    tbl.Range.Cells(iRow%, 2).Value = objModelCol.name
...

Running the above bit of VBA code in Excel 365 64-bit, I discovered that my column name "Hospital CoN Beds" was returned by the objModelCol.Name object as "Hospital Con Beds". In subsequent code this does not match to the actual name, so a lot of my logic is failing. It seems to change all words to proper case if the capital letters aren't consecutive.

Has anyone else seen this, and is there a workaround besides changing every testing instance to a UCase$()?
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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