error with user defined

M

Martyn

I am trying to display the properties of a file.
But I keep getting a "user-defined" error on the
Dim DSO As..........line of the macro.
Can someone correct me please?
--------------------------
Private Sub Workbook_Open()
Dim FileName As String
Dim DSO As DSOleFile.PropertyReader
Set DSO = New DSOleFile.PropertyReader
FileName = "D:\Sitem_Excel\motor.xls"
With DSO.GetDocumentProperties(sfilename:=FileName)
Debug.Print .AppName
Debug.Print .Author
Debug.Print .ByteCount
Debug.Print .Company
Debug.Print .Title
Debug.Print .Subject
Debug.Print .Author
Debug.Print .Category
Debug.Print .Keywords
Debug.Print .Comments
End With
End Sub
 
B

Bob Phillips

Hi Martyn,

Try this late binding version

Private Sub Workbook_Open()
Dim FileName As String
Dim DSO As Object
Set DSO = CreateObject("DSOleFile.PropertyReader")
FileName = "c:\myTest\volker1.xls"
With DSO.GetDocumentProperties(sfilename:=FileName)
Debug.Print .AppName
Debug.Print .Author
Debug.Print .ByteCount
Debug.Print .Company
Debug.Print .Title
Debug.Print .Subject
Debug.Print .Author
Debug.Print .Category
Debug.Print .Keywords
Debug.Print .Comments
End With
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
M

Martyn

Hi Bob,
Thanks for the answer. But using your suggestion I get a "Run-time error
'429': ActiveX component can't create object error" this time. By the way I
am using XL 2000 with WindowsXP.
 
M

Martyn

Thanks Tom, I managed to install the *.dll but fail to test it. Couse I
haven't got VB5 or VB6 on my PC. Anyway I do not get any errors now when I
run the macro but I ain't getting any Properties either on myscreen?
 
B

Bob Phillips

Martyn,

The code is outputting the results to the VBE immediate window.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
M

Martyn

Bob thank you ...You were correct. It displays the results to the VBE
immediate window.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top