Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted
Could you paste your code for openning the template?

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

Posted

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

Posted (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 by SonicBoomAu

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

Posted

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

  • 2 weeks later...
Posted

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.

 

:)

Please check the Knowledge Base before you post.

"Computers are useless. They can only give you answers." - Pablo Picasso

The Code Net

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...