Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2004

Tip: Looking for answers? Try searching our database.

Creating custom form to select info that will print separately

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Trent - 10 Nov 2004 15:05 GMT
Hi,
I am trying to come up with a system that will allow me to generate a form
dynamically and then output the selections made on that form to a custom
template.

I will have an unknown number of client names that I can read from a text
file and populate into a listbox (I have this working already).
I also plan to read a text file with a list of events that each customer can
be signed up for and generate checkboxes with the event names next to each.
I have info on how to do this but have not played with it yet.

My intention is to allow the user to select a client, display all possible
options for that client and let the user add checks next to each option they
will be signed up for.

The next phase would be to output that information into a custom formatted
template that will print the clients itinerary information.

I would greatly appreciate if someone could give me a general idea of how to
approach passing information into a custom template.
I have never worked with templates before but then again, I have never done
any VBA or macro coding in Word either but I have come a long way quickly.
If I just have a basic understanding of how to approach the task I can
figure it out on my own or by researching the particular methods online.  I
just need the idea of how to start.

Anybody?  Please?
Thanks..  Trent
Jean-Guy Marcil - 10 Nov 2004 20:02 GMT
Trent was telling us:
Trent nous racontait que :

> Hi,
> I am trying to come up with a system that will allow me to generate a
[quoted text clipped - 25 lines]
> Anybody?  Please?
> Thanks..  Trent

One fairly easy painless way of doing this is to store each piece of
information in the template as Autotexts.
Then, connect each textbox to the appropriate autotext. If a textbox is
checked, insert the autotext, if not, don't...

Another way would be to have each piece of text on the template body itself,
marked by a bookmark. Then hide (or delete if this in a one shot deal for
the user) the unwanted bits by using the bookmark collection.

I prefer the first one, but again, it depends on your particulars... I.e,
the second method will not really work if the pieces can be in any order as
dictated by the users. OTOH, a quick and dirty advantage of the second
method is that you can have the userform show up later (with a toolbar
button), and the user can change his mind on what to display, in which case
hide/unhide the necessary bits.

HTH.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

Trent - 11 Nov 2004 18:04 GMT
Unfortunately, most all of this is outside of my experience.

I have managed to create a custom dialog box that reads data from a text
file and then creates checkboxes for each entry from the text file.
Then I can drop the selected data into the document easily enough, but as to
placing it in specific locations I am still lost.

Any chance you know where I can find even a very basic sample of doing this?
Once I know how to define the location in the document and pass to it from
the dialog box I should be able to figure out and modify as I go.
I have the added complexity of having to accomodate two columns in the
document where the client is on one side and the spouse on the other and
have to make certain that the time line aligns one side to the next.  I
figure it will probably just require a table to keep the related sections in
each column aligned but that is also something I have never done in Word.
:)

Sorry, I am a newbie.  I have a lot of programming experience and can figure
things out quickly enough once I have some idea of the best approach in that
particular environment.  I work best by dissecting code that does something
similar to what I intend and figuring out how it works.

Thanks for the info.
Trent

> Trent was telling us:
> Trent nous racontait que :
[quoted text clipped - 53 lines]
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site: http://www.word.mvps.org
Jean-Guy Marcil - 11 Nov 2004 18:32 GMT
Trent was telling us:
Trent nous racontait que :

> Unfortunately, most all of this is outside of my experience.
>
[quoted text clipped - 14 lines]
> related sections in each column aligned but that is also something I
> have never done in Word. :)

Play around with this to get you started:

'_______________________________________
Dim MyDoc As Document
Dim RowNum As Long
Dim i As Long
Dim j As Long
Dim MyTable As Table
Dim MyRow As Row
Dim CellRange As Range
Dim InsertTablePoint As Range

Set MyDoc = ActiveDocument

RowNum = 5 'or the number of checked checkboxes
With MyDoc
   Set InsertTablePoint = .Paragraphs(1).Range
   InsertTablePoint.Collapse
   Set MyTable = .Tables.Add(InsertTablePoint, RowNum, 2)
End With

With MyTable
   For i = 1 To RowNum
       Set MyRow = .Rows(i)
       j = 1
       With MyRow
           For j = 1 To 2
               Set CellRange = .Cells(j).Range
               CellRange.Text = "Text # " & i & " - " & j & "."
           Next
       End With
   Next
End With

MyDoc.UndoClear

Set CellRange = Nothing
Set MyRow = Nothing
Set MyTable = Nothing
Set MyDoc = Nothing
Set InsertTablePoint = Nothing
'_______________________________________
Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.