Lost code and non functioning userforms in a workgroup template...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I just started working with word 2003 but have coded with vba for a long
time. On this new job I started I inherited a word template that I was asked
to add a command button, some drop down features and some textboxes. My
question is: Everytime I complile and save the template in the workgroup
template area, the word template does not fully function (i.e. the command
button generates a userform, but when the userform's option buttons are
picked the the userform should change a textbox in the main document - and it
doesn't) It will work for me (always) but it will not work for others. It has
nothing to do with the macro setting (low). Also I notice my code is missing
after the document is saved? I'm perplexed to say the least. Any idea's...
 
Try adding some diagnostics to find where the code is stopping. If the
UserForm comes up, then at least some of your code is working. If the form
code is failing, why are there no error messages?

'Code is missing' -- Your code should not be present in any documents
anyway. Either it's in the template, or it's in an add-in.

BTW: Otium Cum DignITATE
 
The problem occus only when another person is using the document so
breakpoints won't work. I believe where ever the coding is being stored is
not being saved or not being read by another user. There's something about
normal.dot that's probably is not saving my work.
One problem I see is that I'm using controls on the document itself. If
this is true, how do you launch a userform without using a command button. I
also would like to execute subroutines from a form field without using a
macro. I'd like to turn macros off and call a routine in a module. Any
idea's?
 
You can use breakpoints other than ctrl-f9s: try debug.print or writing to a
run log.

Using controls on the document is usually a bad idea. The more usual
approach is to put all your code and forms into an add-in, and provide a
toolbar or menu.
also would like to execute subroutines from a form field without using a
macro. I'd like to turn macros off and call a routine in a module.

This makes no sense. Routines, sub or otherwise, ARE macros. Macros are code
same as all other routines. Even if the core of your routine is compiled in
a DLL, you still need some local code (aka a macro) to call it.

And nothing's going to work until you fix the Latin.
 
I still haven't found my problem but I called microsoft and asked if I could
use controls on a document and they said it was ok. Actually there wasn't any
problem with the controls only a problem with my template. When a person
chooses a new document based on my template, the expected vba doesn't work.
However on exit, if the user chooses no on save the user is prompted again to
save the template and if the user chooses yes to save, the expected results
are save when the templkate is reopened. I suppose the template should not be
prompted to be saved and the new document is not inheriting the code in the
template. When I get an answer from MS, I'll forward it.

As far as using controls without macros, I tried this and I realize no
module procedure can be executed without going through a normal.dot
reference. This is dissapointing because if I could run procedures with
macros turned off I would not have to worry about viruses and trusted
certifigates.
 
To reiterate what Jezebel told you. Using controls in a document is usually
a bad idea. It requires expert-level programming and still may have
unforseen effects. At a minimum, it will activate a macro warning. Ask
Microsoft about that when you talk with them.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide




--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
I found my error. In my coding I mistakenly called an object by it's parent
name an not the inherited one (i.e. thisdocument instead of activedocument).
This mistake did in fact save the results to the template and also why I was
so prompted. I have reintroducted control labels instead of formfields since
they are only 255 characters in length and don't have as much run time
manipulation. I haven't noticed any macro warnings since I run in very high
security and place the template in the workgroups location (a trusted
location). Thanks for the help! I really want to push the boundaries of
controls on word documents, maintaining an electronic stream in legal
contracting is important for productivity, security and saves trees.
 

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

Back
Top