Cannot set contentTypeProperty value in Workbook on Sharepoint using VBA (Type Mismatch)

gge

New Member
Joined
Aug 31, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi,
I try to set the value of builtinDocumentProperties and contentTypeProperties of a workbook saved in a Sharepoint.
Some properties have string values but other have been configured to select one item amongst a limited set of values.

When I try to set the value of such contentTypeProperty, it says me "Type mismatch". I guess it is because the type of such item (which is 0) is not a string but something else and I don't know what and how to set the value.

Could you please help me?

You can find some screenshot of the code and the error.
 

Attachments

  • Screenshot 2021-09-01 at 00.10.46.png
    Screenshot 2021-09-01 at 00.10.46.png
    113.3 KB · Views: 7
  • Screenshot 2021-09-01 at 00.10.30.png
    Screenshot 2021-09-01 at 00.10.30.png
    105.3 KB · Views: 6
  • Screenshot 2021-09-01 at 00.06.17.png
    Screenshot 2021-09-01 at 00.06.17.png
    98.8 KB · Views: 6
  • Screenshot 2021-09-01 at 00.03.35.png
    Screenshot 2021-09-01 at 00.03.35.png
    107.1 KB · Views: 7

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Gokhan Aycan

Active Member
Joined
Aug 8, 2021
Messages
399
Office Version
  1. 365
Platform
  1. Windows

gge

New Member
Joined
Aug 31, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I can't check these out, however, my guess is the items of Master File Type are enumerations.

MetaProperty object (Office)
MetaProperties members (Office)
Workbook.ContentTypeProperties property (Excel)

Would you get anything in the Immediate window?

? wbconso.ContentTypeProperties.Item("Master File Type").Value
? wbconso.ContentTypeProperties.GetItemByInternalName("Master File Type").Value

Maybe you can work something from there.
Hi,

The first row returns a "Type Mismatch" error.
The second one returns a "object variable or with block variable not set" while I am setting an Metaproperty object like this:

Dim ObjMetaProp as MetaProperty

Set ObjMetaProp = wbconso.ContentTypeProperties

MsgBox ObjMetaProp.GetItemByInternalName("Master File Type").Value

I am really blocked , I don't find any solution for this and I don't find anything relevant in the documentation of Office or Excel.

How can I get and set the value of this enumeration ?
 

Forum statistics

Threads
1,148,193
Messages
5,745,263
Members
423,941
Latest member
CluelessAboutExcel

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
Top