Combo Box Not Printing

O

Owen

I am using Microsoft Word 2003. I have a protected document which contains
the following code:

Sub AddHardware()
ActiveDocument.Unprotect Password:="ngo999"
Dim oRng As Word.Range
Set oRng = ActiveDocument.Tables(15).Rows.Last.Range
oRng.MoveEnd wdCharacter, -2
oRng.Select
Selection.Copy
Selection.InsertRowsBelow 1
Selection.Paste
PopulateHardwareCB
End Sub
Sub PopulateHardwareCB()
Dim oTbl As Word.Table
Dim oCtrMaster As Object
Dim oCtrSlave As Object
Set oTbl = ActiveDocument.Tables(15)
Set oCtrMaster = oTbl.Cell(3, 1).Range.InlineShapes(1).OLEFormat.Object
Set oCtrSlave = oTbl.Cell(oTbl.Rows.Count,
1).Range.InlineShapes(1).OLEFormat.Object
oCtrSlave.List = oCtrMaster.List
ActiveDocument.Protect (wdAllowOnlyFormFields), Password:="ngo999",
NoReset:=True
End Sub

The original document contains a Combo Box in the first row of a table. The
macro copies the Combo Box and its list items and pastes them to a new row
created below the previous row in the table.

When the Combo Boxes are created, the selected items successfully print.
However, if the document is closed and re-opened, the selected item still
appears but will not print.


I have tried printing to printer and to Adiobe PDF but the Combo box appears
blank even though it is populated within Word.

Does anyone have any ideas?
 
G

Graham Mayor

While the AddHardware macro appears to work without problem at least as far
as reproducing the row, including combo boxes in the cells(and the resulting
document will print after re-opening), it is not clear what the
PopulateHardwareCB macro is doing in the absence of a better description of
your table and its contents. We cannot therefore test your code.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
O

Owen

Hi Graham

When my Word document opens, it adds a list of items to the first Combo Box
in the table, which is located at Row 3 in the table.

The PopulateHardwareCB macro populates all additional Combo Boxes which are
created from the AddHardware macro.

I used the PopulateHardwareCB macro beacuse the AddHardware macro copies the
Combo Box, but not the list items.

Hope this helps explain the problem.
 
G

Graham Mayor

The initial macro copies the complete row, including the content. Are you
then removing the content and applying new content?
Personally I wouldn't use content controls in a protected form. Dropdown
boxes are altogther easier to manage and work across Word platforms. My own
approaches to adding table rows can be found at
http://www.gmayor.com/word_vba_examples.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top