PDA

View Full Version : Userform Textbox Targeting/Source



benz360
04-11-2007, 08:13 AM
Hi I'm new to creating WORD userforms.

My Question is , how do I get a table cells text to load in a textbox when I first initialize the userform. Then the user can enter/edit/change text and it will change the text in teh table cell.

I've tried Bookmarks and code similiar to:

With ActiveDocument.Tables(1). Cell (3,1)
.Range_.Textbox1.Text

Excel VBA seems so much easier :banghead:

PLEASE HELP!!!

lucas
04-11-2007, 08:58 AM
I would look into using bookmarks. A few results of searching the word forum for table and userform...

http://www.vbaexpress.com/forum/showthread.php?t=11434&highlight=table+userform

http://www.vbaexpress.com/forum/showthread.php?t=11427&highlight=table+userform

http://www.vbaexpress.com/forum/showthread.php?t=11131&highlight=table+userform

benz360
04-11-2007, 09:32 AM
Incredibly Helpful Thanks Lucas!

fumei
04-11-2007, 05:51 PM
Sub Userform1_Initialize()
Dim strCell As String
strCell = ActiveDocument.Tables(1).Cell(3,1).Range.Text
strCell = Left(strCell, Len(strCell) - 2)
Textbox1.Text = strCell
End Sub

Sub CommandButton1_Click()
ActiveDocument.Tables(1).Cell(3,1).Range.Text = TextBox1.Text
End Sub