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 / Publisher / Programming / January 2005

Tip: Looking for answers? Try searching our database.

How are objects identified for VBA?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mcwhirt3@msu.edu - 11 Jan 2005 02:11 GMT
In excel i use vba to control objects(wordart, boxes, lines...etc.)
However in excel it is clear what each object's "name" is in that
dialog box in the toolbar, so that you may refrence it in code. In
Publisher I basically want to have a userform with a tetxbox that dumps
it's contents into a textbox on a poster template in publisher. I just
don't know what to do for the "controlsource" property of the textbox.
I've tried generically assigning it to "textbox1" but that doesn't seem
to work. How do i relate code to objects if i don't know what the name
of the object is? Thanks for any help.
Ed Bennett - 13 Jan 2005 23:12 GMT
mcwhirt3@msu.edu <mcwhirt3@msu.edu> was very recently heard to utter:
> In excel i use vba to control objects(wordart, boxes, lines...etc.)
> However in excel it is clear what each object's "name" is in that
[quoted text clipped - 5 lines]
> doesn't seem to work. How do i relate code to objects if i don't know
> what the name of the object is? Thanks for any help.

I haven't programmed against Excel or Word, so I'm not really sure what the
big differences are, but in Publisher you reference a shape as follows
  <Document Object such as ActiveDocument>.Pages(pageid).Shapes(shapeid)

I tend to either create shapes at runtime so I can assign them to objects
and keep them in check that way, or I use the selection
  Selection.ShapeRange(1) returns the first selected object (I tend to make
sure there is only one object selected to simplify things)
  Selection.TextRange returns the selected text range if text within a text
box is selected.

If you haven't already done so, check out the VBA help files at c:\Program
Files\Microsoft Office\Office11\1033\VBAPB10.CHM (default location, will
vary with language and install folder)

Signature

Ed Bennett - MVP Microsoft Publisher

 
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.