Doug,
Sorry for the delay in my reply -- I needed to sit back and analyze what
I already have -- Here's what I'm trying to do with this project:
I'm trying to create the following -- the final step involves removing
ALL macros from the Active Document when saved
I have a Word.dot that has a variety of BookMarks in it -- PLUS a series
of forms which allow the user to:
a. Fill-In Text Boxes which populated bookmarked areas in the Header
and Body of the Active Document
**** Eventually, I will tie into our database to pull much of
this data to populate these fields in the active document
b. Click Checkboxes and Radio Buttons to add Paragraphs of Text in the
body of the Active Document
**** As the user makes these selections, the Body of the Active
Document is customized for this user
c. Click Checkboxes and Radio Buttons to add data to the Active
Document (comprised of 5 columns of data from a Word Table in a separate
Word Document)
**** This table that is be created lists the items the user has
selected -- 3 colums will be calculated and summed in a Summary Row
The problem I have here is that if I select more than 1 checkbox or
radio-button item, the (5) columns of data from the 2nd selection gets
nested in Cell (1) of the Row that was added to the Active Document in
the 1st selection. Is there a way that I can force the code in
subsequent selections to insert a completely NEW row into the table (not
nest all 5 cells of NEW data into Row(1) Cell(1) )?
The last thing that needs to occur is for all Macros to be removed from
the Active Document when saving it as a Word.doc -- how can I do this?
Much thanks in advance!
Shane
Let's try a plain English description without any code.
The problem with your code is that I can't tell what everything is.
For example what sort of controls are cbxLinen, cbxPillows,
cbxMattresses? Don't answer that for my benefit. It would be better to
describe what you want to be done, not how you think it should be done.
For example, I can't imagine what the "needs" are that are apparently
satisfied by the 2 Command Buttons -- these command buttons open
various forms (15 to be exact) where the user should make selections
(based on needs), but I am sure that there is a better way to do it.
I suspect that you should be using something more along the lines of
the system used in the following:
http://groups-beta.google.com/group...ublic.word.vba*&rnum=1&hl=en#bf86a5657fe2c34e
--
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,
I apologize if I'm not being clear in what I'm trying to achieve with
this project. It's very easy (with a variety of input from various
members) to choose a lesser course on a project (in terms of overall
functionality).
Let me try again to explain what I'm doing:
1. I have made a Word.dot template -- on this template, I have the
following:
a.frmMain -- which has the following:
-- several Input Text boxes to capture data which is then
inserted into various bookmarks in the Active Document ---- ALL this
works fine at present
-- 2 Command Buttons -- these command buttons open various
forms (15 to be exact) where the user should make selections (based on
needs)
-- several Radio Buttons where the user makes a selection and
Text from an underlying doc is inserted into bookmarks in the Active
Document ---- ALL this
works fine at present
-- A List Box (I think I used some of your code here
which
lists all the bookmarks in the Active Document. Here's how things
currently work:
***** User selects Linen Bookmark in the List Box -- this moves the
cursor to the Linen bookmark in the Active Document
***** User clicks the cmdProducts button which opens frmProducts
(which has the following code)
Private Sub cbxLinen_Click()
If Me.cbxLinen.Value = True Then
ActiveDocument.Bookmarks("Linen").Range.InsertAfter Linen
sFilePath = ActiveDocument.AttachedTemplate.Path & "\Linen.doc"
Selection.InsertFile sFilePath, , False, False
End If
End Sub
Private Sub cbxPillows_Click()
If Me.cbxThawte.Value = True Then
ActiveDocument.Bookmarks("Pillows").Range.InsertAfter Pillows
sFilePath = ActiveDocument.AttachedTemplate.Path &
"\Pillows.doc"
Selection.InsertFile sFilePath, , False, False
End If
End Sub
Private Sub cbxMattresses_Click()
If Me.cbxMattresses.Value = True Then
ActiveDocument.Bookmarks("Matttresses").Range.InsertAfter
Mattresses
sFilePath = ActiveDocument.AttachedTemplate.Path &
"\Mattresses.doc"
Selection.InsertFile sFilePath, , False, False
End If
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Application.ScreenUpdating = True
Me.Hide
End Sub
Private Sub frmSSL_Initialize()
Me.cbxLinen.Value = Null
Me.cbxPillows.Value = Null
Me.cbxMattresses.Value = Null
End Sub
======================================
The above code works OK, but I'm sure there's a better way to handle
this (rather than having to create a separate document for each
Product (ie, Linen.doc, Pillows.doc, Mattresses.doc) NOTE -- I
couldn't get the [Cell(row, column).Range.Text property of the table]
suggestion that Jonathan West offered, or the
[ActiveDocument.Bookmarks("bookmarkname").Range.Cells(1).Range to
refer to the first cell in the bookmark, then increment the number for
the remaining cells.] suggestion that you made on 10/17/06 to work --
Doug, could you please break down the
ActiveDocument.Bookmarks("bookmarkname").Range.Cells(1).Range entry
for me and let me know how to apply it to my project -- I'm struggling
with understanding the directions you've provided
2. After the series of forms have been opened and the proper
selections made, the Active Document now has a list of Products
Selected, with the following fields:
a. Description
b. Details
c. Cost without shipping
d. Cost with shipping
e. Quantity
I need to TOTAL columns C, D, and E in a Product Summary line at the
bottom of the Products Table (This was the last post that I made this
morning)
I hope I've been concise in my requirements Doug -- it's not my intent
to be vague, rather, to be considerate of the time you all take in
helping folks like me -- I REALLY do appreciate all the assistance you
give me!
Thanks in advance for any additional help you can offer.
Shane
-- I used this feature because I didn't know another way to move the
cursor to the desired bookmarks when the
b.
Sorry, but that post purporting to give the whole picture was about
halfway through your series of posts and it does not describe what
you are trying to do from start to finish.
My recent suggestion that you needed to provide the full story was
made because I do not think that you are going in the right
direction.;
--
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
message Doug,
I agree with you Doug. To be honest (and fair to all who have
offered help/advice) -- I outlined the scope of my project in my
initial post, but what I got (as a response) was:
=======================
"Well that is a lot of material to absorb and without the document
it
would be a lot of work to sort out here in the newsgroups. To tell
you
the truth I am simply not up to it gratis at present."
=======================
, so I got the impression that people in these groups were more
prone to offer assistance if you gave it to them in chunks. In say
this, I've seen posts where people have submitted rather lenghty
(and detailed) posts, and several members/MVPs gave their inputs.
This was my detailed post on 10/24/06 -- which was address to you
Doug
==================================
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).
(This was your suggestion Doug -- I just can't seem to get it to
work)
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)
Question: Wouldn't it be much simplier to import the data from an
Excel WB,
and if so, what is the best way to associate the
checkboxes/radio buttons on the forms to the Excel workbook (so that
only
the selected items/data is inserted into the Word.dot)?
Much Thanks In Advance
Shane
For your question 1, "Best" is subjective. Here is one way.
Your approaching this project in blocks is probably NOT going to
result in you getting the best advice.
If you describe the total project, you will be more likely to get
better assistance.
You obviously have some pre-conceived ideas about how each step
should be undertaken and they may not be the best.
--
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
message I have a Word Table in my Active Document that I'd like to SUM
using a cmdCalculateTotal button on a form. Can somone please tell
me how to approach this -- for example -- how would I write the VBA
code to calculate Cells C3:C16 of the table? The Range of the
calculated area is subject to change (depending on the choices the
user makes (selecting checkboxes and radio buttons), so it seems
that I would need to calculate the range of the column (after all
selections have been made, and ADD a Summary Row to the table to
calculate the values.
I'm just not sure the easiest way to approach this
NOTE: I'm trying to approach this project in blocks -- I'm still
working on the issue of getting the table values (selected by the
user) to populate in the Active Document -- I'm close, but not
there yet -- Summing the values would be the next step.
Any help will be greatly appreciated.
Thanks in advance
Shane