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 / October 2006

Tip: Looking for answers? Try searching our database.

VBA & Word Automation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Doctorjones_md - 17 Oct 2006 18:31 GMT
I have a Word document (Proposal Template) that needs to be modified based
on the Items/Services sold/offered to the customer.  What is the best way to
accomplish this?

The Items/Services offered are listed in a Word Table in a separate
document.

Example:

     Firewall
     Description Details Monthly Setup
     Firewall
    Not Included
    NA
    NA

     Firewall
    Cisco PIX 501-10

     ·    10 IPs, 10 Mbps, 7500 Concurrent Connections

     ·    Stateful packet inspection and intrusion protection

     ·    Fully Managed Device, includes 24x7 Monitoring, Rule Changes and
1 Hour Replacement Guarantee
    $xxx
    $xxx

     Firewall
    Cisco PIX 506E

     ·    40 Mbps, 25000 Concurrent Connections

     ·    Stateful packet inspection and intrusion protection

     ·    Fully Managed Device, includes 24x7 Monitoring, Rule Changes and
1 Hour Replacement Guarantee
    $xxx
    $xxx

Ideally, what I'd like to be able to do is:  Provide Option (Radio) Buttons
where the Sales Rep can click store the Rows to be Cut and Pasted into the
Proposal Template.

I considered Bookmards, but I'm not certain that bookmarks will give me
what I need (since the entry spans several columns in a table).  What are my
options?

Thanks in advance.
Doug Robbins - Word MVP - 17 Oct 2006 18:46 GMT
You could have each of the items in a template with each one contained
within a bookmark.  Then you could have a userform with a checkbox against
each item on the userform and then code behind a command button on the form
that deleted the bookmark ranges for the items that were not checked.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

>I have a Word document (Proposal Template) that needs to be modified based
> on the Items/Services sold/offered to the customer.  What is the best way
[quoted text clipped - 48 lines]
>
> Thanks in advance.
Doctorjones_md - 17 Oct 2006 21:30 GMT
Doug,

Thank you for the quick reply -- I'm having some difficulty getting
bookmarks to span 3-4 cells in a table -- is this possible?

For example, if I have a Word Table with "Description"    "Details"
"Monthly Fee"     "Setup Fee" as column headers, is it possible to create a
bookmark for the entire Row (spanning 4 columns)?  I'm relatively new with
VBA -- could you provide me with a starting point (including some sample
code) from which to build on?

Much thanks in advance.

> You could have each of the items in a template with each one contained
> within a bookmark.  Then you could have a userform with a checkbox against
[quoted text clipped - 56 lines]
>>
>> Thanks in advance.
Doug Robbins - Word MVP - 18 Oct 2006 04:56 GMT
It would probably best to have a bookmark for each cell, but you may be able
to use

ActiveDocument.Bookmarks("bookmarkname").Range.Cells(1).Range

to refer to the first cell in the bookmark, then increment the number for
the remaining cells.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Doug,
>
[quoted text clipped - 71 lines]
>>>
>>> Thanks in advance.
doctorjones_md - 24 Oct 2006 09:38 GMT
Doug -- sorry for the delay in my reply -- I've been spending some time
trying to see if I could make some headway on this project ...

Here's what I'm working with:

I have a Word.dot template with (1) form (frmMain)

1.  The code on the Word.dot is:

Option Explicit

Private Sub Document_New()
   frmMain.Show
End Sub
==================================
2.  The code on frmMain is:  (****See explanatory Notes****)

Option Explicit

Private Sub cmdCancel_Click()
   Unload Me
   ActiveDocument.Close SaveChanges:=False
End Sub

'initialize form
Private Sub frmMain_Initialize()

   txtCompany.Value = Null
   txtProject.Value = Null
   txtAddress1.Value = Null
   txtAddress2.Value = Null
   txtCity.Value = Null
   txtState.Value = Null
   txtZip.Value = Null
   txtName.Value = Null
   txtTitle.Value = Null
   txtPhone.Value = Null
   txtMobile.Value = Null
   txtEmail.Value = Null
   txtStateFull.Value = Null
   cbxProcurement.Value = Null

End Sub

'set document population variables from userform input
Private Sub cmdOK_Click()

   Application.ScreenUpdating = False
   With ActiveDocument
       .Bookmarks("CompanyCover").Range.Text = txtCompany.Value
       .Bookmarks("ProjectCover").Range.Text = txtProject.Value
       .Bookmarks("CompanySow").Range.Text = txtCompany.Value
       .Bookmarks("ProjectSow").Range.Text = txtProject.Value
       .Bookmarks("Address1Sow").Range.Text = txtAddress1.Value
       .Bookmarks("Address2Sow").Range.Text = txtAddress2.Value
       .Bookmarks("CitySow").Range.Text = txtCity.Value
       .Bookmarks("StateSow").Range.Text = txtState.Value
       .Bookmarks("ZipSow").Range.Text = txtZip.Value
       .Bookmarks("NameSow").Range.Text = txtName.Value
       .Bookmarks("PhoneSow").Range.Text = txtPhone.Value
       .Bookmarks("MobileSow").Range.Text = txtMobile.Value
       .Bookmarks("EmailSow").Range.Text = txtEmail.Value

   End With

   'Insert Procurement Ts & Cs (****This simply inserts the contes of an
entire file into the Active Document -- I need to be able to discriminate
between which rows in a table to insert into the Active Document****)

   Dim sFilePath As String
   If cbxProcurement = True Then
       ActiveDocument.Bookmarks("Procurement").Select
       sFilePath = ActiveDocument.AttachedTemplate.Path & "\Shane.doc"
       Selection.InsertFile sFilePath, , False, False
       Selection.InsertBreak Type:=wdSectionBreakNextPage
       ActiveDocument.TablesOfContents(1).Update

   'End Insert Procurement T's & C's

   'These are the bookmarks on the page to be inserted into
coverpage/Proposal

   Application.ScreenUpdating = False
   With ActiveDocument
       .Bookmarks("CompanyProc").Range.Text = txtCompany.Value
       .Bookmarks("StateFullProc").Range.Text = txtStateFull.Value
       .Bookmarks("Address1Proc").Range.Text = txtAddress1.Value
       .Bookmarks("Address2Proc").Range.Text = txtAddress2.Value
       .Bookmarks("CityProc").Range.Text = txtCity.Value
       .Bookmarks("StateProc").Range.Text = txtState.Value
       .Bookmarks("ZipProc").Range.Text = txtZip.Value
       .Bookmarks("CompanyProc2").Range.Text = txtCompany.Value
       .Bookmarks("Address1Proc2").Range.Text = txtAddress1.Value
       .Bookmarks("Address2Proc2").Range.Text = txtAddress2.Value
       .Bookmarks("CityProc2").Range.Text = txtCity.Value
       .Bookmarks("StateProc2").Range.Text = txtState.Value
       .Bookmarks("ZipProc2").Range.Text = txtZip.Value
       .Bookmarks("CompanyProc3").Range.Text = txtCompany.Value

   End With

   End If

   Application.ScreenUpdating = True

   Unload Me

End Sub
====================
EXPLANATORY NOTES:  The above codes works, but what I need for it to do is
this --

I've added several additional forms (accessed from frmMain) which have
checkboxes and radio buttons fo the user makes his or her selections.  The
the data in the corresponding bookmarks should then be inserted into the
Word.dot when the OK button is clicked.  Here are my questions:

1.  I need for the SUBMIT button on frmMain to be disabled until the user
makes at least (1) selection from the subordinate forms -- what is the best
way to achieve this?

2.  I need for these (10) forms to insert the corresponding bookmarks into a
Table (1) principal Word.dot -- What I did in the Word.dot was to take your
advice and bookmark the entire row (spanning 4 columns) -- I'm lost on how
to incorporate your code
(ActiveDocument.Bookmarks("bookmarkname").Range.Cells(1).Range).

I'm kinda wrapped around the axle here -- Could you give me an idea what I
need to do to incorportate this functionality -- for example:

Just a simple list of components needed ...

Word.dot - with sample  code
A couple of forms showing code to allow for selected checkboxes/radio
buttons to populate bookmarks in the Word.dot (active document)

Much Thanks In Advance

Shane

> It would probably best to have a bookmark for each cell, but you may be
> able to use
[quoted text clipped - 79 lines]
>>>>
>>>> Thanks in advance.
Doctorjones_md - 24 Oct 2006 13:01 GMT
Doug (or anyone else who might have an idea),

Just wondering if this code might get me to where I need to be (in using
checkboxes/radio buttons on a series of forms to populate bookmarks in a
table on my Active Document -- SOF.dot:

Bookmark, Replace Text of a Bookmark in document2 With the Text of a
Bookmark in document1:
Note that both documents must be open when the macro is run.
Documents("c:\temp\document2.doc").Bookmarks("doc2BookmarkName").Range.Text
= _
  Documents("c:\temp\document1.doc").Bookmarks("doc1BookmarkName").Range.Text
Alternate Code:
Documents("c:\temp\document2.doc").Bookmarks(1).Range.Text = _
  Documents("c:\temp\document1.doc").Bookmarks(4).Range.Text
where the text of the 4th bookmark in document1 is replacing the text of the
1st bookmark in document2.

Thanks in advance for your assistance in pointing me in the right direction

Shane
===========================================
> Doug -- sorry for the delay in my reply -- I've been spending some time
> trying to see if I could make some headway on this project ...
[quoted text clipped - 220 lines]
>>>>>
>>>>> Thanks in advance.

Rate this thread:






 
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.