Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


sxz



616 posts

Ultimate Geek
+1 received by user: 132


Topic # 24588 28-Jul-2008 19:35
Send private message

Hi,

I have been using some precidents (templates) in a .doc format.

They remind me of my youth, where I dabbled in some QBASIC stuff (very minor word games mostly). What I mean by this is, the precident will be say a paragraph of text, then in blue writing with italics it shows some options that seemingly you can choose.

For example:
On application
without notice, the Court made a temporary protection order against
[5=Respondent’s full name], the respondent on [6=date of order], which order is now final [7=in whole 
OR  in part]
[8=with modifications  OR  without modification].# ...

Then later in the text, if the respondent's full name is needed again, it is still used as the number 5 (instead of counting up like it seems the rest of the new fields do) leads me to believe there should be some sort of option in Word or otherwise where I can enter this information once in the text and have them all changed?

I have come across word doc's that ask you questions and fill out the form automatically (like that basic Qbasic stuff....) is that what I could get going?

Cheers for your help guys

sxz

Create new topic
3049 posts

Uber Geek
+1 received by user: 902

Trusted
Subscriber

Reply # 152193 28-Jul-2008 20:52
Send private message

Hi Sam

A generic answer to your question is "yes".

Giving a very simplistic overview, there's 2 different ways you can go about this.  Both of them involve Visual Basic for Applications (VBA) - one to a much lesser degree than the other.

Option 1:
Create a form based on formfields

This option will use less code than going full blown VBA and will can be just, if not sometimes more, effective than a 'total' VBA approach, especially in forms that are not particularly complex.

From the basic piece of the (legal looking) form info you've posted I would recommend this as the way to go.

a. Create the document in Word.

b. Where Respondent's Full Name first needs entering add a Text formfield.  Call it Respondent1.  Wherever else it needs entering enter another Text formfield.  Call them Respondent2, Respondent3 etc.

c. Similar sort of thing for dates.

d. Have a drop down field for the location the form was completed (ie, Auckland, Christchurch, Dunedin, Hamilton, Wellington etc).

d. Protect the document as a form.

When your form layout is finished get into the VBA editor (press Alt+F11) - you'll need to write code to replicate data across the "duplicate" form fields (i.e. Respondent's Full Name) whenever they change (most easily achieved by setting the property of the initial field to "Run a Macro" when it is tabbed out of.

Note:
Fields which will receive "duplicate" information should be set so they can't be edited once document protection is turned on, other wise errant users might end up typing different names into different name fields!  (The VBA code will automatically unprotect and reprotect the document during the field replication process).


Option 2:
Go full blown VBA

Basically you'll design the form in Word but will have a space where the data goes instead of a formfield.  Into this space (again using the name as an example) you would insert a Bookmark and name it Respondent1.  Duplicate name spaces would be Respondent2 etc, just like above.

You'll also need to place a bookmark at the beginning of the next word on from the name so that you can have a dialogue box which allows you to quickly edit the original data.  Using two bookmarks allows for fast data retrieval.

It'll take more time to write the code as you'll need to develop a dialogue box first (after deciding what data the user needs to enter) for whatever data needs entering/editing.  Then you'll need to write the code to fill out your form from the entries in the dialogue box.

---------------------

I hope I haven't confused you, I can knock stuff like this out reasonably quickly and haven't had a need to try and explain it before... I'm self taught so there may well be more efficient ways of doing this and much better ways of explaining it.  Other people will jump in pretty quick if there is! Smile

It isn't really complicated, but I've always found the key is in understanding how the form will be used and later edited.  Once you know that you know how complicated it's going to look and which approach will be best.  The next thing is getting your form (template) looking right.

The smarts behind it should be fairly rapid to implement with the right understanding/layout.

You'll find plenty of references on the 'net to help you out with writing VBA code, or you could look at hiring or buying a book on the subject.  I can help too but I'm several thousand kms away from you at the moment so my responses may be a lot slower than you'd like due to work commitments, time zones etc.

All the best
Steve


Create new topic



Twitter »

Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:





News »

Exhibition to showcase digital artwork from across the globe
Posted 23-May-2018 16:44


Auckland tops list of most vulnerable cities in a zombie apocalypse
Posted 23-May-2018 12:52


ASB first bank in New Zealand to step out with Garmin Pay
Posted 23-May-2018 00:10


Umbrellar becomes Microsoft Cloud Solution Provider
Posted 22-May-2018 15:43


Three New Zealand projects shortlisted in IDC Asia Pacific Smart Cities Awards
Posted 22-May-2018 15:14


UpStarters - the New Zealand tech and innovation story
Posted 21-May-2018 09:55


Lightbox updates platform with new streaming options
Posted 17-May-2018 13:09


Norton Core router launches with high-performance, IoT security in New Zealand
Posted 16-May-2018 02:00


D-Link ANZ launches new 4G LTE Dual SIM M2M VPN Router
Posted 15-May-2018 19:30


New Panasonic LUMIX FT7 ideal for outdoor: waterproof, dustproof
Posted 15-May-2018 19:17


Ryanair Goes All-In on AWS
Posted 15-May-2018 19:14


Te Papa and EQC Minecraft Mod shakes up earthquake education
Posted 15-May-2018 19:12


Framing Facebook: It’s not about technology
Posted 14-May-2018 16:02


Vocus works with NZ Police and telcos to stop scam calls
Posted 12-May-2018 11:12


Vista Group signs Aeon Entertainment, largest cinema chain in Japan
Posted 11-May-2018 21:41



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.