5 replies
Have you considered using an Access Database to hold the terms an conditions and using mail merge to create the finished document?
I'm afraid I'm not too familiar with Word programming either.
John
by creed
by sankulpune
Hello cjones,
Create a table in the subdocument and leave the first row blank and one term/condition each in the second column of each row.
Remove check-boxes. I tried hard, but found it impossible to get their value.
Now open the subdocument("TermsTable.doc").
Type Y in the first column of the term/condition you want to include in the template. Leave other rows blank.
Now open the template document ("TemplateDoc.doc") and paste the following code in its VBE.
Sub CopyTerms()
' Code by SanganakSakha 6/7/01
' No comprehensive error checking
Dim subDoc As Document
Dim temDoc As Document
Dim termTable As Table
Set subDoc = Documents("TermsTable.doc")
Set temDoc = Documents("TemplateDoc.doc")
Set termTable = subDoc.Tables(1)
Dim totRos As Integer, totCols As Integer, cpTxt As String
totRos = termTable.Rows.Count
totCols = termTable.Columns.Count
Dim roKount As Integer, colKount As Integer
For roKount = 1 To totRos
If Left(Trim(CleanString(termTable.Cell(1, 1).Range.Text)), 1) = "Y" Then
cpTxt = Trim(CleanString(termTable.Cell(roKount, 2).Range.Text))
cpTxt = Left(cpTxt, Len(cpTxt) - 1)
temDoc.Activate
Selection.TypeText Text:=cpTxt
subDoc.Activate
End If
Next
Set subDoc = Nothing
Set temDoc = Nothing
End Sub
Run this code and selected terms/conditions will be pasted in the template.
I have successfully tried this code with a single line text in the second column.
I would be glad to provide any more help you may need in this regard.
With best regards,
Sanganaksakha,
Your Friend in Need.
by creed
Sanganaksakha, Thank you!
I have some questions about this, and I have developed some code that is useful however I have two problems with the code. Could you email me and I could send the code to you to look over and hopefully answer my questions.
My email address is cjones@valottery.state.va.us
I look forward to hearing from you, Thanks again, Connie
by creed
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending