Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

ActiveDocument and VB

Options
  • 22-04-2010 6:53pm
    #1
    Registered Users Posts: 539 ✭✭✭


    Not sure if this is the right place to put this so mods feel free to move it if necessary.

    So basically I have an application that was previously hosted on Server 2003 and IIS6. Last week the application was moved to server 2008 and IIS7.5

    The application worked on the old server but now it just crashes.

    Here is the bit of code that causes it to crash. It gives me this error "Error while looping over the tags and values. This command is not available because no document is open. 4248" error code 4248.

    Dim wdApp

    ' Create the word object
    Set wdApp = Server.CreateObject("Word.Application")
    if Err.number <> 0 Then
    nErr = 1
    szErr = " Error creating the Word Object " & Err.Description
    Exit sub
    End if

    ' Open the Template document
    wdApp.Documents.Open sSourcePath
    if Err.number <> 0 Then
    nErr = 1
    szErr = " Error Opening the template document " & sSourcePath & " " & Err.Description
    Exit sub
    End iF

    Dim arrTags, arrValues
    Dim iLoop

    ' Organise the Strings
    arrTags = Split(sTags, ", ")
    arrValues = Split(sValues, " | ")

    ' Loop over the strings pulling out the assigned values
    For iLoop = 0 To UBound(arrTags)
    ---> wdApp.ActiveDocument.Content.Find.Execute arrTags(iLoop), , True, , _
    , , , , , arrValues(iLoop), 2
    if Err.number <> 0 Then
    nErr = 1
    szErr = " Error while looping over the tags and values " & Err.Description & Err.Number
    Exit Sub
    End If
    Next

    I was reading something about Microsoft Office Server Extension in order to get this work but I can only find reference to it for MS Office 2000

    Any help would be appreciated.


Comments

  • Registered Users Posts: 539 ✭✭✭but43r


    By the way ----> is not acctually in the code, I only marked it for the forum to show where is the problem.


Advertisement