Taking Pictures from Word and Populating Imageboxes in a Userform 
Author Message
 Taking Pictures from Word and Populating Imageboxes in a Userform

Hi All,

I am trying to take graphic files(i.e. *.bmp, *.jpg, etc.)
from Word and populate image control boxes on a UserForm.  
As soon as the UserForm is activated, I want the pictures
to automatically populate the image control boxes.  Then,
I want to have the option to replace the picture and put
it back into the Word document.  I am doing this through a
UserForm because I want to be able to edit and update
fields, including graphical objects/pictures like *.bmp
and *.jpg files, across multiple Word documents.  When I
update the fields and/or change the picture, it should
update all documents with those fields.  

In this case, would I use "IncludePicture" fields or
bookmarks as markers in the Word document?  I found an MVP
article re "Extracting a picture from an Image Control in
a UserForm."  However, I am still uncertain as to how I
can populate the Image Control in a UserForm.  Any help on
this would be greatly appreciated.  Thanks.

Simon    



Sat, 28 Aug 2004 09:13:35 GMT  
 Taking Pictures from Word and Populating Imageboxes in a Userform
Hi Simon,

To load a picture into and image control on a userform, use

Image1.picture=LoadPicture("c:\windows\argyle.bmp")

You should be able to get the path\filename of a picture in an
IncludePicture field in your document by parsing the code of the field.

Please post any response to the newsgroups for the benefit of others who may
also be following the thread.

Hope this helps,
Doug Robbins - Word MVP

Quote:
> Hi All,

> I am trying to take graphic files(i.e. *.bmp, *.jpg, etc.)
> from Word and populate image control boxes on a UserForm.
> As soon as the UserForm is activated, I want the pictures
> to automatically populate the image control boxes.  Then,
> I want to have the option to replace the picture and put
> it back into the Word document.  I am doing this through a
> UserForm because I want to be able to edit and update
> fields, including graphical objects/pictures like *.bmp
> and *.jpg files, across multiple Word documents.  When I
> update the fields and/or change the picture, it should
> update all documents with those fields.

> In this case, would I use "IncludePicture" fields or
> bookmarks as markers in the Word document?  I found an MVP
> article re "Extracting a picture from an Image Control in
> a UserForm."  However, I am still uncertain as to how I
> can populate the Image Control in a UserForm.  Any help on
> this would be greatly appreciated.  Thanks.

> Simon



Sat, 28 Aug 2004 19:40:41 GMT  
 Taking Pictures from Word and Populating Imageboxes in a Userform
Thanks Doug for the tip.  The method you provided works
great if you hard code both the file path and specific
graphic file into the VB code.  However, I'm trying to
come up with code to automatically populate the Image
Control box with some "variable" graphics file shown in
the Word doc.  

I tried playing around with the INCLUDEPICTURE field, but
I'm guessing that this field property only works if you
hard code the file path of the picture you want.  Is there
a way, or some code using variables, to pick up the
picture from a Word doc by using some field property
and/or bookmarks?

My ultimate purpose is to be able to change the picture on
the UserForm, insert it back into a specific location on
the Word doc, and then update the same picture across
multiple document templates, i.e. changing the company
logo across multiple company document templates.  Sorry
about this being so long-winded, but I'm really stuck.  
Thanks.      

Quote:
>-----Original Message-----
>Hi Simon,

>To load a picture into and image control on a userform,
use

>Image1.picture=LoadPicture("c:\windows\argyle.bmp")

>You should be able to get the path\filename of a picture
in an
>IncludePicture field in your document by parsing the code
of the field.

>Please post any response to the newsgroups for the

benefit of others who may
Quote:
>also be following the thread.

>Hope this helps,
>Doug Robbins - Word MVP


>> Hi All,

>> I am trying to take graphic files(i.e. *.bmp, *.jpg,
etc.)
>> from Word and populate image control boxes on a
UserForm.
>> As soon as the UserForm is activated, I want the
pictures
>> to automatically populate the image control boxes.  
Then,
>> I want to have the option to replace the picture and put
>> it back into the Word document.  I am doing this
through a
>> UserForm because I want to be able to edit and update
>> fields, including graphical objects/pictures like *.bmp
>> and *.jpg files, across multiple Word documents.  When I
>> update the fields and/or change the picture, it should
>> update all documents with those fields.

>> In this case, would I use "IncludePicture" fields or
>> bookmarks as markers in the Word document?  I found an
MVP
>> article re "Extracting a picture from an Image Control
in
>> a UserForm."  However, I am still uncertain as to how I
>> can populate the Image Control in a UserForm.  Any help
on
>> this would be greatly appreciated.  Thanks.

>> Simon

>.



Sun, 29 Aug 2004 08:57:22 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Background picture doesn't display when taking copy off of a Word template

2. Populate ImageBox Control on a VB Form

3. Taking data out of Userforms - help required

4. IMAGEbox dropped onto another imagebox flakey

5. putting a imagebox picture on a picturebox in the stretch mode

6. how to scale picture in PictureBox or ImageBox

7. Using Data instead of Picture files to populate a picture of a control

8. Passing Userforms to subs (Word 2000 and 2002, I did not try Word 97)

9. Word 97 - Userform within Word VBA macro and exchange of values

10. populating OL UserForm with Name/E-address data

11. Userform: populate textbox with date from another textbox

12. Userforms - populating textboxes

 

 
Powered by phpBB® Forum Software