Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2006

Tip: Looking for answers? Try searching our database.

assigning a value to a table cell using VBA in word

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mark_jm - 21 Mar 2006 15:28 GMT
I  am using vba code as code assigned to a button on a user form.
The offending code is

Dim mytable As Table

Set mytable = ActiveDocument.Tables(1)
MsgBox (mytable.Cell(1, 1))
id = student(numc, 2)                                       ' where numc is
an integer used to select the sorrect table row
mytable.Columns(1).Cells(1) = id                 'Student is an array holding
values read from the form

It falls over highlighting the code ".Cells(1)=" in blue stating error
message " invalid use of property".

The help at that point talks about property let and property get statements ?

I have also tried mytable.Cells(numc,1) and mytable.cells(1, 1) just to try
and get it working with no joy

Please help
Tony Jollans - 21 Mar 2006 15:44 GMT
Try using ...

   mytable.Columns(1).Cells(1).Range = id

or, more explicitly, ...

   mytable.Columns(1).Cells(1).Range.Text = id

--
Enjoy,
Tony

> I  am using vba code as code assigned to a button on a user form.
>  The offending code is
[quoted text clipped - 17 lines]
>
> Please help
mark_jm - 21 Mar 2006 20:22 GMT
Fantastic....thanks .............you dont know how long I've been messing
about with that

Regards

Mark

>Try using ...
>
[quoted text clipped - 13 lines]
>>
>> Please help
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.