+ Reply to Thread
Results 1 to 11 of 11

Macro to enlarge a picture

  1. #1
    Registered User
    Join Date
    08-30-2004
    Posts
    16

    Question Macro to enlarge a picture

    I have rows of records of Computer Aided Design (CAD) files with a thumbnail picture in the first column. I would like to have a button or a toggle in each row so that when a user selects this, the adjacent picture expands. It would then shrink again on selection of a second button or re-selection of the toggle. Can anyone help me with this?
    Rob

  2. #2
    CLR
    Guest

    RE: Macro to enlarge a picture

    You might consider putting the pictures in the comment boxes instead of a
    cell on the subject row. These comment boxes will automatically pop up to
    whatever size you wish on mouse-over and drop back out of sight when the
    mouse is moved off the cell..........works really cool.


    Vaya con Dios,
    Chuck, CABGx3




    "WightRob" wrote:

    >
    > I have rows of records of Computer Aided Design (CAD) files with a
    > thumbnail picture in the first column. I would like to have a button
    > or a toggle in each row so that when a user selects this, the adjacent
    > picture expands. It would then shrink again on selection of a second
    > button or re-selection of the toggle. Can anyone help me with this?
    > Rob
    >
    >
    > --
    > WightRob
    > ------------------------------------------------------------------------
    > WightRob's Profile: http://www.excelforum.com/member.php...o&userid=13799
    > View this thread: http://www.excelforum.com/showthread...hreadid=548638
    >
    >


  3. #3
    Registered User
    Join Date
    08-30-2004
    Posts
    16

    Pictures in comment boxes

    Thanks for the suggestion. I had thought of doing that but can't figure out how to get the picture into the comment box. Copy and paste doesn't seem to work. Can you let me know how to do it.
    Thanks, Rob

  4. #4
    Registered User
    Join Date
    08-30-2004
    Posts
    16

    Enlarge picture macro

    I have found a partial solution. I have recorded 2 macros, one to enlarge the picture and one to reduce it. I have assigned these macros to buttons adjacent to the picture. The problem with this is that the macro applies to a specific picture. To make this work, I would have to record 2 macros for every picture. (I have a lot of records!). Does anyone know how to make the macro apply to the picture next to the button selected?

  5. #5
    CLR
    Guest

    Re: Macro to enlarge a picture


    Select the cell, Right-click > InsertComment.........move the cursor to the
    border of the Comment Box where it turns into a black cross and Left-click,
    then left-click on the little arrow next to the FillBucket, then choose
    FillEffects, then the PictureTab, then SelectPicture and choose a picture,
    then OK, OK.........

    Vaya con Dios,
    Chuck, CABGx3


    "WightRob" wrote:

    >
    > Thanks for the suggestion. I had thought of doing that but can't figure
    > out how to get the picture into the comment box. Copy and paste doesn't
    > seem to work. Can you let me know how to do it.
    > Thanks, Rob
    >
    >
    > --
    > WightRob
    > ------------------------------------------------------------------------
    > WightRob's Profile: http://www.excelforum.com/member.php...o&userid=13799
    > View this thread: http://www.excelforum.com/showthread...hreadid=548638
    >
    >


  6. #6
    Registered User
    Join Date
    08-30-2004
    Posts
    16

    Thumbs up Ok

    Thanks CLR that works well. As you say, nice effect.

  7. #7
    CLR
    Guest

    Re: Macro to enlarge a picture

    You're welcome, happy to help.........as you say, Excel is not really a
    "drawing tool" as such....but with a few tricks, one can produce some really
    amazing results, and the conditional formatting can make things REALLY
    interesting. Oh yeah, besides the "broken intersection" another neat
    thing to make is the one where one line "jumps over" the other, with a little
    arc. Come back again, we don't often get the opportunity to discuss the
    drawing-characteristics of Excel here.

    Vaya con Dios,
    Chuck, CABGx3



    "WightRob" wrote:

    >
    > Thanks CLR that works well. As you say, nice effect.
    >
    >
    > --
    > WightRob
    > ------------------------------------------------------------------------
    > WightRob's Profile: http://www.excelforum.com/member.php...o&userid=13799
    > View this thread: http://www.excelforum.com/showthread...hreadid=548638
    >
    >


  8. #8
    CLR
    Guest

    Re: Macro to enlarge a picture

    You're welcome, and here's a little code to Resize the CommentBox if you
    wish........just type a number, say 50, in A1 and A2 and select the cell with
    the CommentBox you want to resize, and then run this macro...

    Sub ResizeCommentBox()
    ActiveCell.Comment.Shape.Height = Range("a1").Value
    ActiveCell.Comment.Shape.Width = Range("a2").Value
    End Sub


    Vaya con Dios,
    Chuck, CABGx3


    "WightRob" wrote:

    >
    > Thanks CLR that works well. As you say, nice effect.
    >
    >
    > --
    > WightRob
    > ------------------------------------------------------------------------
    > WightRob's Profile: http://www.excelforum.com/member.php...o&userid=13799
    > View this thread: http://www.excelforum.com/showthread...hreadid=548638
    >
    >


  9. #9
    Dave Peterson
    Guest

    Re: Macro to enlarge a picture

    Even though you're happy with Chuck's solution, you could use buttons from the
    Forms toolbar and have your code determine which picture to modify.

    Option Explicit
    Sub testme()

    Dim myButton As Button
    Dim myPict As Picture
    Set myButton = ActiveSheet.Buttons(Application.Caller)
    Set myPict = FindPicture(myButton, ActiveSheet)
    If myPict Is Nothing Then
    MsgBox "No picture on that button's row"
    Else
    'code to adjust picture
    MsgBox myPict.Name
    End If

    End Sub


    Function FindPicture(myBTN As Button, wks As Worksheet) As Picture

    Dim myPict As Picture
    Dim PictToAdj As Picture

    With wks
    Set PictToAdj = Nothing
    For Each myPict In .Pictures
    If Intersect(.Range(myPict.TopLeftCell, myPict.BottomRightCell), _
    myBTN.TopLeftCell.EntireRow) Is Nothing Then
    'keep looking
    Else
    Set PictToAdj = myPict
    Exit For 'stop looking
    End If
    Next myPict
    End With

    Set FindPicture = PictToAdj

    End Function


    WightRob wrote:
    >
    > I have found a partial solution. I have recorded 2 macros, one to
    > enlarge the picture and one to reduce it. I have assigned these macros
    > to buttons adjacent to the picture. The problem with this is that the
    > macro applies to a specific picture. To make this work, I would have
    > to record 2 macros for every picture. (I have a lot of records!). Does
    > anyone know how to make the macro apply to the picture next to the
    > button selected?
    >
    > --
    > WightRob
    > ------------------------------------------------------------------------
    > WightRob's Profile: http://www.excelforum.com/member.php...o&userid=13799
    > View this thread: http://www.excelforum.com/showthread...hreadid=548638


    --

    Dave Peterson

  10. #10
    CLR
    Guest

    Re: Macro to enlarge a picture

    Ha.......bet you're wondering what I was talking about here, huh.......it's
    just my response to another post, got mixed up with this one, sorry.....

    Vaya con Dios,
    Chuck, CABGx3



    "CLR" wrote:

    > You're welcome, happy to help.........as you say, Excel is not really a
    > "drawing tool" as such....but with a few tricks, one can produce some really
    > amazing results, and the conditional formatting can make things REALLY
    > interesting. Oh yeah, besides the "broken intersection" another neat
    > thing to make is the one where one line "jumps over" the other, with a little
    > arc. Come back again, we don't often get the opportunity to discuss the
    > drawing-characteristics of Excel here.
    >
    > Vaya con Dios,
    > Chuck, CABGx3
    >
    >
    >
    > "WightRob" wrote:
    >
    > >
    > > Thanks CLR that works well. As you say, nice effect.
    > >
    > >
    > > --
    > > WightRob
    > > ------------------------------------------------------------------------
    > > WightRob's Profile: http://www.excelforum.com/member.php...o&userid=13799
    > > View this thread: http://www.excelforum.com/showthread...hreadid=548638
    > >
    > >


  11. #11
    Registered User
    Join Date
    08-30-2004
    Posts
    16

    Thumbs up To CLR and Dave Peterson

    OK guys.

    Thanks to CLR for your suggestion, I was a bit confused with your further comments but interested so I may follow up the other thread you were responding too.

    Thanks also to Dave Peterson for your suggestion, I haven't had time to check it out yet but I will.

    This thread had become a little confusing so I think I'll close it now and start a new one if I need further help.

    Rob

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1