Question

I have a VS2010 Vb.net program that creates a Word 2007 file.

My Normal.dot file is customised to give me a new Tab with Buttons in that do specific things via VBA in the Normal.dot program when those Buttons are pressed.

This all works fine, however, I now want to add some functionality whereas as soon as the new Word document is created, it edits a Task in Outlook.

I have edited the 2 "This Document" Procedures and you can see my Normal.Dot file in the attached Screenshot.

My Normal.Dot template

When I run my VB.Net program to create a brand new Word 2007 document, the program does NOT stop on either of the message boxes, it just continues and opens the Word document as before, my code is below, what am I doing wrong ?!?

    'Open or Create Word document for Editing

    myNewsLetter = myFolder + myLeague + "News" + mySession + ".doc"

    If File.Exists(myNewsLetter) Then
        'do nothing
    Else
        myTemplate = myTempFolder + "NL Skeleton.doc"
        File.Copy(myTemplate, myNewsLetter)
        Create_Blank_Newsletter()
    End If

    'Open Word Newsletter, or switch to it if it's already open

    Dim myFileOpen As Boolean

    myFileOpen = IsFileOpen(myNewsLetter)

    If myFileOpen = False Then
        MSDoc = MSWord.Documents.Open(myNewsLetter)
    End If

    MSWord.WindowState = Word.WdWindowState.wdWindowStateNormal
    MSWord.Visible = True
    MSWord.ActiveDocument.Bookmarks("\StartOfDoc").Select()
Was it helpful?

Solution

OK, sorted this, the full discussion can be found here ... http://www.vbaexpress.com/forum/showthread.php?p=286771#post286771

Basically, I'm not creating a NEW document, I am creating a new document via a Copy and then opening that existing document !!!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top