Windows Vista Forums

Word Automation

  1. #1


    Volker Schillings Guest

    Word Automation

    Hi,

    I have a question about the automation of Word objects. With following code
    I open a word document:

    $services = @(Get-Service)
    $msWord = new-object -ComObject "word.application" -ea silentlycontinue
    $wordDoc = $msWord.Documents.Open("somedocument.doc")

    ....do something with the worddoc....



    $msWord.Documents.Close()
    $msWord.Quit()

    With the PS script, I want to make a batch processing over a lot of
    documents. In some cases, a word file might be used by another user or there
    might be a further inquiry with a dialogbox. In this case, the script will
    wait for an user interaction. Is it possible to make a automation for those
    user inquiries?
    Thanks a lot for helping me! :-)

    Bye, Volker

      My System SpecsSystem Spec

  2. #2


    Marco Shaw [MVP] Guest

    Re: Word Automation

    > With the PS script, I want to make a batch processing over a lot of

    > documents. In some cases, a word file might be used by another user or
    > there
    > might be a further inquiry with a dialogbox. In this case, the script will
    > wait for an user interaction. Is it possible to make a automation for
    > those
    > user inquiries?
    > Thanks a lot for helping me! :-)
    Are you able to provide a bit more details? I'd like to think you can do
    anything...

    Marco


      My System SpecsSystem Spec

  3. #3


    Volker Schillings Guest

    Re: Word Automation



    "Marco Shaw [MVP]" wrote:

    > > With the PS script, I want to make a batch processing over a lot of
    > > documents. In some cases, a word file might be used by another user or
    > > there
    > > might be a further inquiry with a dialogbox. In this case, the script will
    > > wait for an user interaction. Is it possible to make a automation for
    > > those
    > > user inquiries?
    > > Thanks a lot for helping me! :-)
    >
    > Are you able to provide a bit more details? I'd like to think you can do
    > anything...
    >
    > Marco
    >
    Hi Marco,

    in detail, we want to check every word document for the used template path.
    A lot of documents are containing a private network path. If you open this
    document outside the intranet, it takes several minutes. So, we want to check
    for the path with:

    ....
    $template = $wordDoc.AttachedTemplate.FullName
    if ($template.Contains("`\`\")) {
    ....
    If there is a reference to a private networt path, we change and save the
    file.
    The problem is now, that a lot of files require a user interaction while
    opening the file with powershell. For example, if another user has the file
    in use, a dialog box will appear and the powershell script will stop and
    wait. I want to know, how it is possible to handle those user interactions
    with powershell. Do you need more details?

    Best wishes!

    Volker


      My System SpecsSystem Spec

Word Automation

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: excel automation mr_unreliable VB Script 0 21 Aug 2009
Need help with powerpoint automation... reinhold.fiedler VB Script 1 23 Oct 2008
Word Automation on Custom Properties Probi .NET General 0 16 Apr 2008
Word Properties Automation Probi .NET General 0 16 Apr 2008
Automation classes... Help! Nick_Journals Avalon 0 02 Feb 2006