MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Getting Excel DSO Properties in VBA Code

  Asked By: Arland    Date: Sep 16    Category: MS Office    Views: 3305

Does anyone know how to import the Custom Properties from and Excel
file into VBA code ?

I am setting variable names in Excel and making them Custom
Properties. I would like to access that data without opening Excel,
and have that data be a variable in a VBA 6.0 project.



1 Answer Found

Answer #1    Answered By: Alice Hughes     Answered On: Sep 16

Try this:

Sub Test()
Set MyObj = CreateObject("Excel.Application")
'MyObj.Visible = 1
MyObj.Workbooks.Open ("C:myfile.xls")

c = MyObj.Workbooks(1).CustomDocumentProperties.Count

For Each prop In MyObj.Workbooks(1).CustomDocumentProperties
n = prop.Name
v = prop.Value
MsgBox n & "=" & v
Set MyObj = Nothing
End Sub

Didn't find what you were looking for? Find more on Getting Excel DSO Properties in VBA Code Or get search suggestion and latest updates.