Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Run Word thru XL? (XL97/WinNT4)

    I've tried to find posts regarding this on Search and just got 'No matches', so I'm obviously having my usual luck with finding search terms. Sorry.

    I wish to assign values to built in (and custom) properties in Word documents, using an XL spreadsheet which contains all the values and the paths/doc names. I know I'm going to need an array to cycle through them, but what I haven't been able to work out is how to refer to Word VBA terms in XL?

    For instance, I need to refer to 'documents(pathA + "" + nameA)' but of course documents is not a valid keyword in XL! Nor will the names of the builtin properties, or any of the rest of the code I need to use ...

    I don't need to open Word or the documents (unless that's the only way to assign values to their properties), just refer to them!

    Any assistance would be gratefully appreciated!
    Beryl M


  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Run Word thru XL? (XL97/WinNT4)

    You can do one of two things:

    1. Use Automation to control Word in code from Excel. Moderator <!profile=WendellB>WendellB<!/profile> has a short tutorial on Automation on his website (see his profile), with links to useful information. You can also search for Word.Application in this forum or in the VBA forum.

    2. Dsofile.exe Lets You Edit Office Document Properties from Visual Basic and ASP. The freely downloadable DSOFile.dll is meant for VB6 but can be used from VBA too. It lets you manipulate document properties without opening the documents.

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Run Word thru XL? (XL97/WinNT4)

    Hans, thanks for the links, and it looks like DSOfile is what I wanted, except that everything I can find about it states it can -get- properties, but not that it can -set- properties!

    I'll try the animation one now ...

    <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>
    Beryl M


  4. #4
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Run Word thru XL? (XL97/WinNT4)

    The article states that you can modify the properties (though if the property is ReadOnly it may not be modified).

    Steve

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Run Word thru XL? (XL97/WinNT4)

    Beryl,

    DSOFile can also be used to create properties, and to set (modify) the value of existing ones.

    Dim sFile As String
    Dim oFilePropReader As DSOleFile.PropertyReader
    Dim oDocProp As DSOleFile.DocumentProperties
    Dim oCustProp As DSOleFile.CustomProperty

    sFile = "C:WordTest.doc"

    Set oFilePropReader = New DSOleFile.PropertyReader
    Set oDocProp = oFilePropReader.GetDocumentProperties(sFile)
    oDocProp.Title = Range("A1")
    oDocProp.Author = Range("A2")
    oDocProp.CustomProperties.Item("MyProperty") = Range("A3")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •