Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 2nd, 2013, 06:23 PM
Registered User
 
Join Date: Dec 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Initializing table cell text to a userform textbox

Hi

I am new to working with VBA in word tables and can't figure out how to bring the text from a table cell back into the userform textbox. I have this code and it seems alright just not doing what I want it to do. Please help me!!

Code:
Sub Initialize()

With ActiveDocument.Tables(6)

.TextBox1.text = Left(.Cell(2, 2).Range.text, Len(.Cell(2, 2).Range.text) - 2)
.TextBox2.text = Left(.Cell(3, 2).Range.text, Len(.Cell(3, 2).Range.text) - 2)
.TextBox3.text = Left(.Cell(4, 2).Range.text, Len(.Cell(4, 2).Range.text) - 2)
.TextBox4.text = Left(.Cell(5, 2).Range.text, Len(.Cell(5, 2).Range.text) - 2)
.TextBox5.text = Left(.Cell(6, 2).Range.text, Len(.Cell(6, 2).Range.text) - 2)

End With

End Sub





Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy cell into userform? Cabbage VB How-To 2 April 29th, 2008 07:04 AM
how to get text of a particular cell of selected r jjkk BOOK: ASP.NET AJAX Programmer's Reference : with ASP.NET 2.0 or ASP.NET 3.5 ISBN: 978-0-470-10998-4 0 January 22nd, 2008 07:39 AM
two text alignments in one table cell nikotromus ASP.NET 2.0 Professional 1 March 26th, 2006 07:21 PM
make textbox maximum length of <td> cell crmpicco Javascript How-To 0 October 19th, 2005 10:46 AM
Lose cell Text when editing cell in VSFlexGrid 6 bobcratchet VB How-To 0 July 30th, 2004 09:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.