1
votes

I am working with an application that uses VBscript/ ActiveX to embed Word in a browser. This application is not able to create the Word file to edit in the browser if it is not run as an administrator- instead I get and popup from Word saying: "Word could not create the work file. Check the temp environment variable"

I figured this is a permission issue, but I'm not sure how to fix it. First I was wondering where the file is being written to. I'm not sure if it's the TEMP variable for the current user (C:\users\chris\appdata\local\Temp) or the actual environment variable (C:\Windows\TEMP) or the Internet Explorer temporary internet files directory (C:\users\chris\appdata\local\Temp\Temporary Internet Files).
Also, which user would need permission for the correct folder? Would it be the user that is running IE?

I get an error in the browser once the the Word file fails to load saying that the error is on line 60. The following is the relevant code from the page source:

<SCRIPT Language="VBScript">
    Sub InitWrapper()
    'MsgBox "First line of onLoad"
    oframe.EnableFileCommand(0) = False
    oframe.EnableFileCommand(1) = False
    oframe.EnableFileCommand(2) = False
    oframe.EnableFileCommand(3) = False
    oframe.EnableFileCommand(4) = False
    oframe.CreateNew "Word.Document"  --------------------------------This is line 60
    oframe.ReadRTF ( "{\rtf1\...fonttbl....*MORE HERE*......
    oframe.Activate
    End Sub

    sub Save_Data
        document.THEFORM.content.value = oframe.RTF
    end sub

        sub InsertString(str)
                dim doc
                Set doc = oframe.ActiveDocument
                doc.ActiveWindow.Selection = str
                doc.ActiveWindow.Selection.Collapse wdCollapseEnd
                'Paste directly
                'doc.ActiveWindow.Selection.Paste
                oframe.Activate
                document.THEFORM.content.value = oframe.RTF
        end sub

    sub wrapperUnload()
        oframe.Close
    End Sub
</SCRIPT>

Can anybody point me in the right direction as to what I should be looking for to fix this problem?

1
Word is notoriously bad at being scripted by ActiveX, especially if it's a background process. I know that's not helpful to you right now, but it's all I can come up with... - Mark Henderson
I feel the need to elaborate on this question since it was migrated to StackOverflow.. I am not doing any of the programming at all. This ActiveX already works just fine when I am running the browsers as an administrator (either as an administrator user or normal user and run as an administrator), but when I run it as a normal user I get that mentioned error. I'm wondering is it the browser that should have the permission to run the ActiveX, and since it doesn't- the ActiveX cannot create the file? - OrangeGrover

1 Answers

0
votes

I saw a similar issue, when I am opening a word file embedded in IE browser through activeX, MS word throws the below error message in one of the pop-up boxes

Word could not create the work file. Check the temp environment variable

This is resolved by adding the web applications/site URL to the Trusted Sites List in the IE Browser Security settings.

Hope this helps.