Pergunta

First off, this might be the simplest questions on this site depending on the answer. Question: Is Embedded VB scripts supported in Office Word templates (.dot/.dotx)?

If not, thank you! If it is, why is this not working:

http://postimage.org/image/2uubobv38/

It works flawlessly in a .doc format but not when i try to save it as a template. I'm running Office 2007 but 2003 doesn't work either, is there something special you need to enable for using embedded scripts in a .dot file?

I don't know if this is the proper forum for questions like this, but i really don't know anywhere else to turn regarding programming in general so.. help?

Foi útil?

Solução

Ok so after some logical debugging (read: days), i found out that it IS supported, just not in the "traditional" way of thinking.

In a normal document, you apparently use the Open() function to load things when opening the document, because that's what you do, you open the document.

When using embedded scripts in a .dot file, you're not opening the file.. you are creating a new instance of the .dot file so the function you should be using is New():

Private Sub Document_New()
    UserForm1.Show
End Sub

This should show you form from "opening" a .dot file.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top