Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / June 2007

Tip: Looking for answers? Try searching our database.

Word Automation \ global template issue

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lee.Westcott@googlemail.com - 08 Jun 2007 09:48 GMT
Hi,

Not sure if this is the correct group but here goes.....

I have inherited a VB 6.0 app and as part of its functionality, it
creates a Word 2003 document from a saved custom template then
printouts the page before closing.

The issue being reported is that if the user already has word running,
after creating a new document from the VB application, Word then says
that "Normal.dot" is in use and cannot be saved.

In a nutshell, this process should all be seemless \ transparent
without out prompts from Word. I am told this was the case before the
upgrade from a previous version of word (2002).

The Code being used is....

'Set objWrdDoc = GetObject(, "Word.Application")

If objWrdDoc Is Nothing Then
   bNewWrdApp = True
   Set objWrdDoc = CreateObject("Word.Application")
End If

' Associate our custom template with word instance.
Set doc = objWrdDoc .Documents.Add("MyFile.dot")
'
'
' Assignment of data to bookmarks etc
'
'
'

objWrdDoc.Application.PrintOut
objWrdDoc.ActiveDocument.SaveAs "My.doc"
objWrdDoc.Application.DisplayAlerts = False

Do While objWrdDoc .BackgroundPrintingStatus = 1
Loop

'If bNewWrdApp = True Then
   objWrdDoc.Application.Quit
   objWrdDoc.Application.DisplayAlerts = True
Else
    doc.Close
End If

Set doc = Nothing
Set objWrdDoc = Nothing
Jonathan West - 08 Jun 2007 10:24 GMT
Add the following line just before the Application.Quit

objWrdDoc.Application.NormalTemplate.Saved = True

This will kid Word into believing that nothing in normal.dot has changed,
and so it doesn't need to be saved when Word is closed.

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

> Hi,
>
[quoted text clipped - 46 lines]
> Set doc = Nothing
> Set objWrdDoc = Nothing
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.