• Change Word Doc from VBA

    Author
    Topic
    #356411

    This is probably a simple problem, but it seems to be eluding me. I want to write a VB program (not a macro) that will open a Word document, make changes, which would include AutoSummarize, then save the file and move on to another document. This seems trivial, but I am stumbling around. Any good examples?

    Viewing 4 reply threads
    Author
    Replies
    • #527427

      Briana,

      It may be that you’ll need to be a bit more specific about what you’re trying to do, in order to get any targeted help.

      For starters: are we talking about doing this with VBA (i.e. from within a VBA host app), or are we talking about doing this with a VB app? (Strictly, you don’t need a VB app to do this; it can be done within Word for instance.)

      What kind of changes do you need to make, and what are the sources of problems?

      Do you need to loop through all the files in a directory, a drive, or what? – there’s been code posted in this forum for looping through all the files in a directory – probably can be located by doing a Search of this forum.

      Gary

    • #527453

      Cathy:

      Thanks! That was just the push I needed. I already have the DSOFile Object library that will let me read the properties of Office documents. I had written a VB app that will find all of the DOC files on my system and list the keywords associated with each document, but I found that some of the documents lacked keywords. This should fix the problem.

      Gary: Sorry if I wasn’t clear in my original post.

      Brian A

    • #527543

      True, but what I’m trying to do is let Word scan the document for keywords using the Autosummarize function, then update the Properties with the keywords. So any future scans using DSOFile should show the keywords without having to open that document.

      In effect, I’m writing an app that will help find WORD documents via keywords.

      As an aside, I’ve discovered that DSOFile will error out in Visual Basic if a file with a .DOC extention is not a WORD document. I can catch the error under W2K, but not W98. Very strange.

    • #537944

      Bill,

      The mso constants are available when using VBA via any of the MS Office apps.
      I’ve never run the DSO code from VB, so I’m not sure how you hook into the Office constants from VB.

      Gary

      • #537959

        It’s the Microsoft Office 9.0 Object Library (from “Tools>References” in the VB editor).

        cheersKlaus

    • #537983

      Can you post the relevant code you’re using?

    Viewing 4 reply threads
    Reply To: Change Word Doc from VBA

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: