This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to modify Word document from M-Files Server VBScript?

Former Member
Former Member
I want to create a script on M-Files server that sets "Track Changes" when a Word document enters a certain state and "Accept All Changes and Stop Tracking" when the document enters a later state.

State Draft: "Track Changes"
State Submitted: -
State Reviewed: -
State Accepted: "Accept All Changes and Stop Tracking"
State Issued: - (next state is Draft for next major version of document)

I found the place in M-files Server Administrator to create the VB Script: Vault/Workflows/Properties/State/Edit/Actions/Run Script

According to the documentation the following variables can be used in the script: VaultSharedVariables, MFScriptCancel, CurrentUserID, Vault, DisplayID, ObjVer, PropertyValues, and StateID.

In Word VBScript I can set this propertiy by with:

ActiveDocument.TrackRevisions = True

How to do the same from M-Files server script?

Best regards

Erik
Parents
  • Former Member
    Former Member
    Hello again,

    I managed to start Word from my script:

    Dim word: Set word = CreateObject("Word.Application")

    The question now is how to specify the file name (docxFile) to be able to open the word document? I want to do the following:

    Dim doc: Set doc = word.Open(docxFile, false)
    doc.TrackRevisions = True

    When I try to print out ObjVer.GetNameForFileSystem I don't get any result in my log file.

    In the M-Files client I can locate the file manually at M:\yellow\Favorites\Bosa Copy (ID 108).docx

    On the M-Files server, when I search for the file I only find the database. D:\M-Files\Server Vaults\yellow.

    Is there a way to access the file (and use as parameter to Word) on the M-Files server?
Reply
  • Former Member
    Former Member
    Hello again,

    I managed to start Word from my script:

    Dim word: Set word = CreateObject("Word.Application")

    The question now is how to specify the file name (docxFile) to be able to open the word document? I want to do the following:

    Dim doc: Set doc = word.Open(docxFile, false)
    doc.TrackRevisions = True

    When I try to print out ObjVer.GetNameForFileSystem I don't get any result in my log file.

    In the M-Files client I can locate the file manually at M:\yellow\Favorites\Bosa Copy (ID 108).docx

    On the M-Files server, when I search for the file I only find the database. D:\M-Files\Server Vaults\yellow.

    Is there a way to access the file (and use as parameter to Word) on the M-Files server?
Children
No Data