?
Solved

Automated Word 2003 Forms using VBA

Posted on 2011-03-09
3
Medium Priority
?
271 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Accepted Solution

by:
borgunit earned 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
Suggested Courses
Course of the Month11 days, 10 hours left to enroll

752 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