Word VBA Errors

S

Shoukhat Khan

Hello,

I have a VB application which calls the templates stored on a network share.
These templates support wordbasic. Everything was fine untill Office 2003,
but when i upraded to Office 2007 the word templates have stopped working.
Whenever the VB application tries to open the file it throws an error "Sub or
Funcion not defined" and "Microsoft Visual Basic" written in the title bar.
I've also added the network share in the trusted locations. Can anybody help
me solve this issue please?
 
J

Jonathan West

Shoukhat Khan said:
Hello,

I have a VB application which calls the templates stored on a network
share.
These templates support wordbasic. Everything was fine untill Office 2003,
but when i upraded to Office 2007 the word templates have stopped working.
Whenever the VB application tries to open the file it throws an error "Sub
or
Funcion not defined" and "Microsoft Visual Basic" written in the title
bar.
I've also added the network share in the trusted locations. Can anybody
help
me solve this issue please?

You need to open up the VBA editor and find out which line of code is
causing the error. Once you know which line of code is causing the error,
you can start working out what needs to be changed to prevent it.
 
S

Shoukhat Khan

Thanks for the reply Jonathan, I tried to see the code through VBA editor and
the code seems to be blank. Maybe it has been protected or has disallowed
access to see it. I have the original templates, how do i see the code
through VBA editor?
 
J

Jonathan West

Shoukhat Khan said:
Thanks for the reply Jonathan, I tried to see the code through VBA editor
and
the code seems to be blank. Maybe it has been protected or has disallowed
access to see it. I have the original templates, how do i see the code
through VBA editor?

Press Alt-F11 to open the editor. In the pane on the left, which shows the
list of documents and templates that might contain code, double-click on the
template you want. If the code is password-protected, then you will be
prompted for the password.

If the code you want is in an add-in rather than in Normal.dotm or in a
template attached to a document, then you need to open the add-in as a
document before you will be able to see the code in the VBA editor.
 
S

Shoukhat Khan

Hello Jonathan,

Maybe my questions would be a bit too light as i am not so well verse with
owrd templates and macros. I tried to see the code as suggested by you, but
if i open the template normally through File...Open command it never shows me
the macros. If i use my VB application to call the template then only it
shows the code. Any idea how i can overcome this?
 
J

Jonathan West

Shoukhat Khan said:
Hello Jonathan,

Maybe my questions would be a bit too light as i am not so well verse with
owrd templates and macros. I tried to see the code as suggested by you,
but
if i open the template normally through File...Open command it never shows
me
the macros. If i use my VB application to call the template then only it
shows the code. Any idea how i can overcome this?

Open the template. Then open the VBA editor. Then double-click on the
template's VB project in the VBA editor. if there is a password, you will
now be prompted for it.

If you want to get to grips with the basics of Word programming, take a look
at these articles. The fact is that if you don't have some idea of what you
are doing in terms of writing VBA code, you are unlikely to be able to work
out what is going wrong with the code which somebody else wrote.

What do I do with macros sent to me by other newsgroup readers to help me
out?
http://www.word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm

Creating a macro with no programming experience using the recorder
http://www.word.mvps.org/FAQs/MacrosVBA/UsingRecorder.htm

Getting To Grips With VBA Basics In 15 Minutes
http://www.word.mvps.org/FAQs/MacrosVBA/VBABasicsIn15Mins.htm

There are lots more articles on the Word MVPs website - VBA is something you
never entirely finish learning - but these should get you started.
 
S

Shoukhat Khan

Thanks for this information Jonathan, one more thing what i noticed was, If i
open try to get into VB editor to see the macros all of them have
disappeared. The macros which i can see for the same document under
Office2003 are not visible in Office2007. Is it any security issue which is
stopping these macros from loading.

I have also enabled all the macros in the trust centre and also added the
netowrk share in the trusted locations.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top