Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Image Controls

I am attempting to study VBA in excel. Mostly from a text book. In the book
at the end of each chapter "challenges" are set. I'm doing fine with the
exception of the following....

"Draw a simple image of a smiley face using 'ms paint' then load the image
into an Image Control placed on a worksheet in Excel. (No problem so far.)
Using the MouseDown() event procedure of the Image Control write a procedure
that displays a message to the user every time the user clicks on the
image.(Now the hard bit!) The message should tell the user if they clicked
on the eyes, nose, mouth or face and which button they used. (Where do the
buttons come into the image??) The message can be displayed with a Message
Box, or in a Label Control or on the spreadsheet."

That's it, - any ideas would be most welcome.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Image Controls

Private Sub Image1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer,
ByVal X As Single, ByVal Y As Single)

From the Image's MouseDown Event Help File entry:

Button Required. An integer value that identifies which mouse button caused
the event.
Shift Required. The state of SHIFT, CTRL, and ALT.
X, Y Required. The horizontal or vertical position, in points, from the left
or top edge of the form, Frame, or Page.

Using these you should be able to get all the info you need. Any point
(eyes, mouth, etc) on your picture will be at a particular x,y point and you
may need to experiment to find the right values for these (try MsgBox X & ":"
& Y while you test this - so any time you click you will see what x and y
are; by clicking in the area around the eyes, nose, etc. you should be able
to come up with ranges of values that correspond to these points). Will
leave the rest for you since the whole point is to learn, right?

"Sandy" wrote:

I am attempting to study VBA in excel. Mostly from a text book. In the book
at the end of each chapter "challenges" are set. I'm doing fine with the
exception of the following....

"Draw a simple image of a smiley face using 'ms paint' then load the image
into an Image Control placed on a worksheet in Excel. (No problem so far.)
Using the MouseDown() event procedure of the Image Control write a procedure
that displays a message to the user every time the user clicks on the
image.(Now the hard bit!) The message should tell the user if they clicked
on the eyes, nose, mouth or face and which button they used. (Where do the
buttons come into the image??) The message can be displayed with a Message
Box, or in a Label Control or on the spreadsheet."

That's it, - any ideas would be most welcome.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Image Controls

Works brilliantly

Thanks

"K Dales" wrote in message
...
Private Sub Image1_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer,
ByVal X As Single, ByVal Y As Single)

From the Image's MouseDown Event Help File entry:

Button Required. An integer value that identifies which mouse button
caused
the event.
Shift Required. The state of SHIFT, CTRL, and ALT.
X, Y Required. The horizontal or vertical position, in points, from the
left
or top edge of the form, Frame, or Page.

Using these you should be able to get all the info you need. Any point
(eyes, mouth, etc) on your picture will be at a particular x,y point and
you
may need to experiment to find the right values for these (try MsgBox X &
":"
& Y while you test this - so any time you click you will see what x and y
are; by clicking in the area around the eyes, nose, etc. you should be
able
to come up with ranges of values that correspond to these points). Will
leave the rest for you since the whole point is to learn, right?

"Sandy" wrote:

I am attempting to study VBA in excel. Mostly from a text book. In the
book
at the end of each chapter "challenges" are set. I'm doing fine with the
exception of the following....

"Draw a simple image of a smiley face using 'ms paint' then load the
image
into an Image Control placed on a worksheet in Excel. (No problem so
far.)
Using the MouseDown() event procedure of the Image Control write a
procedure
that displays a message to the user every time the user clicks on the
image.(Now the hard bit!) The message should tell the user if they
clicked
on the eyes, nose, mouth or face and which button they used. (Where do
the
buttons come into the image??) The message can be displayed with a
Message
Box, or in a Label Control or on the spreadsheet."

That's it, - any ideas would be most welcome.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bitmap data of Image controls & Picture objects... MDB[_2_] Excel Programming 0 November 5th 04 08:30 PM
Bitmap data of Image controls & Picture objects... MDB Excel Programming 1 November 4th 04 06:35 AM
Image and WebBrowser Controls JT[_2_] Excel Programming 2 September 17th 04 08:44 PM
Image Edit and WebBrowser controls JT[_2_] Excel Programming 0 September 17th 04 06:54 PM
Bmp vs Gif in Userform image controls Sandy-V[_2_] Excel Programming 0 January 14th 04 01:46 PM


All times are GMT +1. The time now is 02:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"