Word Interop and VB Express

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Philip De Jonghe

    #1

    Word Interop and VB Express

    Hi,

    I searched high and low for an example on how to establish a link with Word
    using VB Express and the .Net Framework 2.0 in it. The code should link with
    the running instance if one's there or by creating a new instance if not.
    And some robustness as to when the user closes Word midstream for some
    reason.

    The idea is to use Word with a set of templates to create a more
    sophisticated billing/quoting paper output engine while allowing pre-print
    manual editing.

    Some sample code :
    Dim w As Microsoft.Offic e.Interop.Word. Application
    w = New Microsoft.Offic e.Interop.Word. Application
    w.Documents.Add (WORDTEMPLATERO OT & "\" & WORDTEMPLATEQUO TE)
    ....

    The above (1) creates a new instance even when an instance already runs and
    (2) crashes if Word is manually closed and the .Add method is called again
    later in the software.

    I struggle a bit from my VB6/COM to VB .Net migration.
    Thanks for any suggestions.

    Philip



Working...