locked
Word Macro Finding Script Broken RRS feed

  • Question

  • I created a script to check for Excel macro's that returns TRUE when a document contains a macro. I then reformatted the code for Word but when I run the script it returns FALSE for all documents (see code below). What am I doing wrong?

    $word = new-object -comobject word.application
        $doc = $word.documents.Open("C:\Path\example.docm")
        Echo $doc.HasVBProject
        $doc.Close()
        $word.Quit()

    Friday, March 18, 2016 8:12 PM

Answers

  • It works for me.  It will not report on macros in  Normal.dot.  Start by creating a document that you know has a local module then test the code.

    \_(ツ)_/

    • Proposed as answer by Elaine Jing Tuesday, March 22, 2016 8:00 AM
    • Marked as answer by Elaine Jing Thursday, April 7, 2016 6:44 AM
    Friday, March 18, 2016 10:40 PM