Opening a Word-document in VBS RRS feed

  • Question

  • I have created a VBS macro that opens a Word-template, writes in it/makes some changes to the document and then saves the document with another name.

    The script works fine on a test server, but when trying to implement the same script on the actual server that i want to use it on it gives me the following error:

    Object required: 'Documents.Open(...)

    The script looks like this:

    Dim documentPath
    documentPath = "C:\Workflow\Template.docx"
    Dim documentName
    documentName = "Controlplan.docx"
    Dim objWord
    Set objWord = CreateObject("Word.Application")
    Dim objDoc
    Set objDoc = objWord.Documents.Open(documentPath,,True)
    objWord.Visible = False
    ***Write something in the document***
    objDoc.SaveAs("C:\Documents\" & documentName)


    • The test server and the actual server are running both on Windows Server 2012 R2 64-bit

    • The test server has Office 2010 installed and the actual server has a Office 365 E3 Licence, this should not be a problem because i have tested the script on a Office 365 and it worked fine.

    • Moved by Dave PatrickMVP Monday, September 23, 2019 12:24 PM looking for forum
    Monday, September 23, 2019 11:17 AM