Results 1 to 9 of 9

Thread: automating word save as different file from template

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    Wisconsin
    Posts
    788

    Resolved automating word save as different file from template

    Here is the code causing the error.
    An unhandled exception of type 'System.NullReferenceException' occurred in ClientApp.exe

    Code:
     
        Private Sub btnCreateWordDoc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreateWordDoc.Click
            Dim WordApp As Word.Application
            WordApp = New Word.Application
            WordApp.Visible = True
    
            Dim myDoc As Word.Document
    
            WordApp.Documents.Add("C:\.netprojects\remoting\ClientApp\template.doc")
    
            myDoc.Bookmarks.Item("bookmark").Range.Text = "test1"
    
            WordApp.Quit(True)
    
        End Sub

    ?????
    Last edited by mojo69; Jul 3rd, 2007 at 05:31 PM.

Posting Permissions

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



Click Here to Expand Forum to Full Width