Solved

Automated Word 2003 Forms using VBA

Posted on 2011-03-09
3
264 Views
Last Modified: 2012-05-11
I'm new to Word Forms so I'm testing out a Word 2003 Form with a few checboxes on it (bkCheck1; bkCheck2, bkCheck2). I've put a Macro on the form that triggers on exit from bkCheck1. The Macro is below and is just a test, so I've made it as simple as I could but it doesn't work. I've locked the form before testing, made sure the MS Office Word 11 Object library has been loaded, enabled Macros and checked the Macro is hooked onto the document. Nothing

Sub Macro1()
ActiveDocument.Bookmarks("bkCheck3").Select
MsgBox ("Check1 checked")
End Sub
0
Comment
Question by:JP53
3 Comments
 
LVL 10

Accepted Solution

by:
borgunit earned 500 total points
ID: 35084439
What you are showing is not a reference to a form object (check box). You are selecting a bookmark named "bkCheck3" being selected and then popping up a msgbox.

I would have expected something like:

If SomeForm.bkCheck3.value = 1 then
   MsgBox ("Check1 checked")
End if
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 35089510
If your macro does not show a message, then it isn't running at all.

The first line should either give an error message and/or carry on to produce the programmed message : - "Check1 checked"

What mechanism are you using to start the macro code?
0
 

Author Comment

by:JP53
ID: 35092894
Hi GrahamSkan,

Already sorted. It seems that the on exit field method reacts in weird ways with Word Forms.

Thanks anyway for the input
J
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question