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 / February 2005

Tip: Looking for answers? Try searching our database.

How can I give meaningful names to word objects?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Simon Kearns - 16 Feb 2005 11:35 GMT
For example: tblMyTable instead of tables(1)

I don't mean:
dim tblMyTable
Set tblMyTable = ActiveDocument.Tables(1)

I mean rather the same way you give name to controls on forms.
e.g. txtLastName instead of TextBox1

Thanks
Simon
Jonathan West - 16 Feb 2005 12:00 GMT
> For example: tblMyTable instead of tables(1)
>
[quoted text clipped - 4 lines]
> I mean rather the same way you give name to controls on forms.
> e.g. txtLastName instead of TextBox1

Hi Simon,

In short, you can't. The best you can do is mark a table with a bookmark and
then work from that, like this

Dim tblMyTable
Set tblMyTable =
ActiveDocument.Bookmarks("MyMeaningfulBookmark").Range.Tables(1)

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

Simon Kearns - 16 Feb 2005 20:43 GMT
Hi Jonathan.
OK. That's Bad.

I need to populate a 'tree diagram' (like a family tree for example) with
Excel data and later insert it into a powerpoint presentation.
I was planning on using text boxes connected by drawn lines to make the
tree. There would be 10-12 of them and they need to be able to be moved
around sometimes. So the text boxes would be distributed vertically and
horizontally.
Does word name objects based on location or creation order? Does the
numbering change (e.g. if I move the box around)? Maybe a table would work
better? We are trying to use word to take advantage of formatting features
and to keep code out of a distributed PowerPoint presentaion but maybe word
is not the application for this job?
Anyway, these are things that I will go away and ponder but any thoughts
most appreciated.
Cheers
Simon

>> For example: tblMyTable instead of tables(1)
>>
[quoted text clipped - 13 lines]
> Set tblMyTable =
> ActiveDocument.Bookmarks("MyMeaningfulBookmark").Range.Tables(1)
Jean-Guy Marcil - 17 Feb 2005 00:09 GMT
Simon Kearns was telling us:
Simon Kearns nous racontait que :

> Hi Jonathan.
> OK. That's Bad.
[quoted text clipped - 14 lines]
> Cheers
> Simon

This is different from naming tables (which can't be named).

You can name a textbox if you create it through VBA.
For example:

'_______________________________________
Const TxtBx As String = "TextBox"
'_______________________________________
Sub CreateBox()

Dim MyTextBox As Shape

Set MyTextBox = ActiveDocument.Shapes. _
   AddTextbox(msoTextOrientationHorizontal, 180#, _
   144#, 198#, 135#)

With MyTextBox
   .Name = TxtBx
   .TextFrame.TextRange.Text = "Text box #1."
End With

End Sub
'_______________________________________

'_______________________________________
Sub DeleteBox()

ActiveDocument.Shapes(TxtBx).Delete

End Sub
'_______________________________________

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org


Rate this thread:






 
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.