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

Hi all, In Path "C:\My Documents\Pictures\" I have four pictures with
the name "My Pic 1.bmp" to "My Pic 4.bmp" I got "Image control" and
two command buttons with the caption "Next" and "Previous" on my
worksheet. I need two macros assigned to both buttons "Next" and
"Previous". I want macro to display picture in image control from
path "C\My Documents\Pictures\" when i click button "Next" and macro
should display next picture every time when i click button "Next". I
assume you might have gussed from my question that what kind of macro
i need for button "Previous". Yes i need macro to display pictures
backword like 4,3,2,1 when i click button "Previous". Both macro
should stop doing any thing when last picture is displayed like in
button "Next" case it will be "My Pic 4.bmp" and in button "Previous"
case it will be "My Pic 1.bmp". I will be greateful if any friend
can
help me.

I tried macro below but its not working
sub ChangePic ()
Dim i as Integer
i = i + 1
Me.Image1.Picture = LoadPicture(""C\My Documents\Pictures\My Pic " & i
& ".bmp")
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Image Control

Somehow you need to keep track of which picture was loaded last. I'm
not sure if you can get this information from the object, so it might
be necessary to keep it in a cell. What I'm getting at is that when
your code says:
Dim i as Integer
i = i + 1
The second line assumes taht i was 0. You actually need to set i to
the last loaded picture. Maybe you could place it in a cell
underneath the picture and do something like this:
sub ChangePic ()
Dim i as Integer
i=activesheet.cells(2,2).value
i = i + 1
activesheet.cells(2,2).value = i
Me.Image1.Picture = LoadPicture(""C\My Documents\Pictures\My Pic " &
i
& ".bmp")
End Sub
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
frame control inside an image control moniong Excel Programming 2 March 30th 07 03:29 AM
Programatically control picture property of Image control Brassman[_5_] Excel Programming 5 May 24th 05 09:32 PM
Image control DC Mile510 Excel Programming 3 January 4th 05 08:54 PM
Displaying a Tif image in the Image Control Neil Excel Programming 1 September 21st 04 12:56 AM
copy shape image into image control Luc Benninger Excel Programming 2 July 15th 04 11:14 AM


All times are GMT +1. The time now is 10:14 AM.

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

About Us

"It's about Microsoft Excel"