ThisDocument Objects (Images)

J

James

A couple questions about working with images (call it
Image1) inserted from the controls toolbox.

First, is it possible to test for the existence of
Image1, so that if it exists, some action is performed,
and if it doesn't some other action is performed?

Second, assume Image1 exists in a template and that
Image1 has some code that performs some action in the
Image1_Click event. Since the Image1_Click event is held
in the template's Microsof Office Word Objects
ThisDocument folder, it does not "attach" itself to a
document based on the template like other items in the
template (i.e., userforms, modules), so the Image1_Click
event in the document based on the template contains no
macro. How can this be transferred?

I should also probably mention that there are actually
two templates involved here. First there is the template
that contains Image1. Second there is a template that
collects the template that contains Image1 into a new
document.

Thank you for any help
 
W

Word Heretic

G'day "James" <[email protected]>,

1) ActiveDocument.Shapes.Count or .InlineShapes.Count reveal the
presence of graphics. In the case of Shapes it can also include Text
Boxes and the like.

2) Using VBProjects.VBComponents

The clever way is to isolate the code to be copied into its own module
so you can just copy the whole damn module over. Alternate methods
include sending the template as well, etc.

Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


James reckoned:
 
J

James

I reposted the same general question (testing for the
existence of an image) Oct 4th, but with some code of
what I was trying to do. Basically I would like to loop
through the collection of images and if an image has a
certain name ("Image 1") I would like to add an item to a
combobox in a userform. The code is in the initialize
event of the userform.

In addition, I found an example of some code that is
similar to what I want (see Sept 10 post, "loop through
controls"). This code turns the value of option buttons
in a document to false. in trying it out in my initialize
event, it turned the value of an option button to false,
but for some reason I would get a type mismatch error
(related to dim statements?) at the end and in any
subsequent try regarding any reference to the userform
(eg, userform.hide). And although it was successful in
dealing with the option buttons, when I tried to modify
it to add an item to the userform, I got an error.

Incidentally, any time I attempt ActiveDocument. I get
instead activedocument. Are any of these problems
related?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top