See the following Knowledge Base article:
"Opening This Will Run the Following SQL Command" Message When You Open a
Word Document - 825765 at:
http://support.microsoft.com?kbid=825765
If you make the changes mentioned in that article, the SQL prompt will no
longer appear.

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> Hi
>
[quoted text clipped - 9 lines]
>
> Have anyone seen this problem before and is there a way around it?
Lasse - 25 Jun 2007 13:16 GMT
Thanks for the reply, it worked perfectly.
> See the following Knowledge Base article:
>
[quoted text clipped - 19 lines]
> >
> > Have anyone seen this problem before and is there a way around it?
Lasse - 25 Jun 2007 15:37 GMT
I take back my words :-)
It removed the SQL command but it still doesn't run the AutoNew macro. I
have tried creating a simple AutoNew macro that just inserts a text string on
line 1 of the document.
I have tried deleting everything inside the document so that their wasn't
anything that could cause the problem.
My simply AutoNew looks like this:
Sub AutoNew()
Selection.InsertAfter ("Bookmark test")
End Sub
> See the following Knowledge Base article:
>
[quoted text clipped - 19 lines]
> >
> > Have anyone seen this problem before and is there a way around it?
Bear - 25 Jun 2007 16:51 GMT
Lasse:
You've used very loose language when describing your actions, so I'm just
going to confirm that you only expect the AutoNew to run one time for any
document -- when that document is first created from a template. You can
either use the GUI and click File > New to create the document, or you can
open the template using the OS. Nothing else, particularly not opening the
document after it's been created, will run the AutoNew sub.
Bear

Signature
Windows XP, Word 2000
Lasse - 26 Jun 2007 07:21 GMT
I know how the AutoNew macro should work and that it's run only once when
creating a new document from the template.
But I have solved the problem. I copied everything from the original
template to a new template and created the AutoNew macro from the bottom and
then it worked.
I suspect that the original template was created in an earlier version of
Word and that was what caused the problem.
> Lasse:
>
[quoted text clipped - 6 lines]
>
> Bear
Ed - 26 Jun 2007 18:30 GMT
Hi Lasse,
> I suspect that the original template was created in an earlier version of
> Word and that was what caused the problem.
Or possibly it was created as a ".doc" and just renamed to be a ".dot"
(which doesn't make it a template).
Regards.
Ed
> I know how the AutoNew macro should work and that it's run only once when
> creating a new document from the template.
[quoted text clipped - 15 lines]
> >
> > Bear