dylanmendes Posted September 26, 2005 Posted September 26, 2005 Dear VB brains, I'm attempting to open a template (.dot file) via my VB application. The intention is to open a new document based on the template as opposed to the template itself i.e. we're trying to reproduce the "file -> NEW" menu functionality! .. and all of this works very well.. NOT!!!! The document opens as expected but when I attempt to close the session, I get a message telling me that the "normal.dot" file is in use by another application. I understand that this "normal.dot" file is something called a Global template. Our application does not explictly open this file. How can I avoid the above message at the time of closing the application? Thanks, Dylan Quote
SonicBoomAu Posted September 27, 2005 Posted September 27, 2005 Could you paste your code for openning the template? Quote Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -- Rick Cook, The Wizardry Compiled
dylanmendes Posted September 28, 2005 Author Posted September 28, 2005 Code snippet... Hi.. thanks for your prompt response. Here it is: Private Sub Command1_Click() Dim appWord As New Word.Application appWord.Visible = True appWord.Documents.Add ("C:\XYZ\abc.dot") End Sub Quote
SonicBoomAu Posted September 28, 2005 Posted September 28, 2005 (edited) Found this link which might set some light on the subject. http://www.ostrosoft.com/vb/projects/template.asp Hope this helps. P.S. Just found another site that might be worth a read. http://support.microsoft.com/default.aspx?scid=kb;EN-US;316383 Edited September 28, 2005 by SonicBoomAu Quote Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -- Rick Cook, The Wizardry Compiled
Scorpio Posted September 30, 2005 Posted September 30, 2005 I have also the same problem, but it doesn't happens always What i have found : If an instance of winword.exe is already running, (like an opened word document, or just Outlook 2003 running (spell checker is using word)) the problem occurs If no winword.exe is running, the msg about the normal.dot does not appear Quote
dylanmendes Posted September 30, 2005 Author Posted September 30, 2005 Well, this article sheds more light though it doesn't provide a feasible solution.. Quote
mark007 Posted October 14, 2005 Posted October 14, 2005 You could try and get the existing instance using getObject: Dim objWord as Object=Microsoft.VisualBasic.Interaction.GetObject(,"Word.Application") dim wdApp as Word.Application if objWord is nothing then wdApp=New Word.Application wdApp.Visible=true else wdApp=Ctype(objWord,Word.Application) end if This way you won't be creating a new instance if it alreday exists. :) Quote Please check the Knowledge Base before you post. "Computers are useless. They can only give you answers." - Pablo Picasso The Code Net
dylanmendes Posted October 17, 2005 Author Posted October 17, 2005 Thanks, Mark.. that's pretty handy! Quote
Recommended Posts