vb.net 2005 DSO equivalent

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MikeR

    #1

    vb.net 2005 DSO equivalent

    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.OleDocu mentProperties
    Dim sFilename As String
    Set DSO = New DSOFile.OleDocu mentProperties

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

    End sub


  • Paul Clement

    #2
    Re: vb.net 2005 DSO equivalent

    On Mon, 7 Aug 2006 18:58:01 -0700, MikeR <MikeR@discussi ons.microsoft.c omwrote:

    ¤ 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.OleDocu mentProperties
    ¤ Dim sFilename As String
    ¤ Set DSO = New DSOFile.OleDocu mentProperties
    ¤
    ¤ DSO.Open sFilename:="C:\ Temp.pdf"
    ¤ On Error Resume Next 'Errors if field is already created
    ¤ DSO.CustomPrope rties.Add "REV", "Revision1"
    ¤ On Error GoTo 0
    ¤ DSO.CustomPrope rties.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)

    Comment

    Working...