vb.net 2005 DSO equivalent

G

Guest

Hopefully someone can help. I am currently looking to convert my Excel VBA
procedure to .net 2005. If anyone can show me the code to go about this it
would be greatly appreciated. I have spent hours upon hours searching news
groups. I am trying to read/write custom file properties.

->Xp Pro
->Reference to the DSO dll in VBA

Sub AddProperty()

Dim DSO As DSOFile.OleDocumentProperties
Dim sFilename As String
Set DSO = New DSOFile.OleDocumentProperties

DSO.Open sFilename:="C:\Temp.pdf"
On Error Resume Next 'Errors if field is already created
DSO.CustomProperties.Add "REV", "Revision1"
On Error GoTo 0
DSO.CustomProperties.Item("REV").Value = "Revision1"
DSO.Save
DSO.Close
Set DSO=Nothing

End sub
 
P

Paul Clement

¤ Hopefully someone can help. I am currently looking to convert my Excel VBA
¤ procedure to .net 2005. If anyone can show me the code to go about this it
¤ would be greatly appreciated. I have spent hours upon hours searching news
¤ groups. I am trying to read/write custom file properties.
¤
¤ ->Xp Pro
¤ ->Reference to the DSO dll in VBA
¤
¤ Sub AddProperty()
¤
¤ Dim DSO As DSOFile.OleDocumentProperties
¤ Dim sFilename As String
¤ Set DSO = New DSOFile.OleDocumentProperties
¤
¤ DSO.Open sFilename:="C:\Temp.pdf"
¤ On Error Resume Next 'Errors if field is already created
¤ DSO.CustomProperties.Add "REV", "Revision1"
¤ On Error GoTo 0
¤ DSO.CustomProperties.Item("REV").Value = "Revision1"
¤ DSO.Save
¤ DSO.Close
¤ Set DSO=Nothing
¤
¤ End sub

There is no equivalent functionality for DSO in .NET. However, you can still use this library in a
..NET app (Project...Add Reference...COM).


Paul
~~~~
Microsoft MVP (Visual Basic)
 

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