I have a userform that opens by use of a command button
which is in a table in a WORD document.
The userform contains multiple pictures and corresponding
option buttons, and an OK and Cancel command button.
I want to be able to select one picture and click OK and
have the picture pasted into the bookmarked cell on the
WORD table.
My pictures are on image boxes. Am I better off putting
pictures on the option buttons?
I will have many cells with different pictures on the
document.
What I'd do is make an AutoText from each image (insert
it inline into a Word doc, I mean, then make an AutoText
from that 'character'). Then have the code for OK button
look to see which option button is checked and insert the
corresponding AutoText in the document, something like
this (note: untested code):
Dim r As Range, t as Table
Set t = ActiveDocument.Tables(1)
Set r = t.Cell(3,3).Range
r.MoveEnd wdCharacter, -1 'Avoid the cell-end marker
ThisDocument.AttachedTemplate. _
AutoTextEntries("alex").Insert Where:=r
HTH.
--
Mark Tangard <Ma...@Tangard.com>, Microsoft Word MVP
Please reply only to the newsgroup, not by private mail.
Note well: MVPs do not work for Microsoft.
"Life is nothing if you're not obsessed." --John Waters
Private Sub cmdOK_Click()
Dim opt As OptionButton
Dim cmd As CommandButton
Dim myform As New myform
Dim r As Range
Dim t As Table
Set t = ActiveDocument.Tables(1)
If optOptionButton2.Value = True Then
Set r = t.Cell(2, 5).Range
r.MoveEnd wdCharacter, -1
ThisDocument.AttachedTemplate.AutoTextEntries
("picture_2").insert where:=r
End If
Unload Me
End Sub
???????????????????????
THANKS!!!!!!!!!!!
>.
>
Darren
>.
>
NormalTemplate.AutoTextEntries("text").insert
where:=ActiveDocument.Bookmarks("bm").Range
>.
>