dcsimg
Results 1 to 2 of 2

Thread: Launching a Word Template through VB NET

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2014
    Posts
    31

    Launching a Word Template through VB NET

    Hey everyone. I've had a few posts in the past related to this kind of issue, but now I'm experiencing something new and would like to see if I could get any assistance with it. I have over 200 individuals using my software. It opens up word on their computer and attaches a template to that document. I've had to create a work around for a few individuals where it will download the template locally onto their computer and then launch it and that works fine.

    Now I just experienced an individual who got a new computer. Installed Office 365 along with my software. Every time we attempt to load Word and attach the template through the software we get: "Error occurred during load" followed by "Could not fire event".

    This is the code associated with opening Word and attaching the template located from a website:

    Code:
                
    
    Try
                    oWord = DirectCast(CreateObject("Word.Application"), Word.Application)
                    oWord.Visible = True
                    oDoc = oWord.Documents.Add(txtRes2.Text)
                Catch ex As Exception
                    MsgBox(ex.Message)
                    Exit Sub
                End Try
    txtRes2.Text is automatically generated by the program and cannot be changed by the user. So the value is correct. Works for everyone else.

    The work around code, as I mentioned before, downloads the template onto their computer and then opens it the following way:

    Code:
    System.Diagnostics.Process.Start(sLoc + "\eScribers Template Manager\data\" + sTempPath)
    So the Process.Start code works for everyone using it, except this one individual. So when I use the software and go through this process.start method I get the fire event error. But then when I go to the location on the computer where the template is downloaded and simply double click on the file, it loads exactly how it should. This is where my confusion has set in. I thought the Process.Start event was no different than me double clicking the file and letting Windows open up the file into the associated program.

    Any help in this would be greatly appreciated and if any further info is required, happy to provide it.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,607

    Re: Launching a Word Template through VB NET

    I would suggest that you log all the information you can for that exception instead of simply displaying the message. That might shed some more light on exactly what's happening. If you're not using a dedicated logging component, it's a good idea to call ToString on the exception and save the result to a log file somewhere and/or email it to your support address.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width