+ Reply to Thread
Results 1 to 6 of 6

changing size of autoshape

  1. #1
    Registered User
    Join Date
    02-01-2005
    Posts
    62

    Question changing size of autoshape

    Trying to do some basic animation with an autoshape. I have a rectangle that I am changing the size in steps. The problem is, it resizes the bottom edge of the rectangle up instead of moving the top edge of the rectangle down.

    here is my code:
    Please Login or Register  to view this content.
    How do I tell VBA to resize my rectangle from the top down?
    Last edited by grime; 01-25-2006 at 11:47 AM.

  2. #2
    Tom Ogilvy
    Guest

    Re: changing size of autoshape

    ltop = ActiveSheet.shapes("Rectangle 1").Top
    For j = 1 To 200
    rectheight = rectheight - 0.5
    Application.ScreenUpdating = False
    ActiveSheet.Shapes("Rectangle 1").Height = rectheight
    Activesheet.Shapes("Rectangle 1").Top = lTop
    Application.ScreenUpdating = True
    For i = 1 To 100
    DoEvents
    Next i
    Next j

    --
    Regards,
    Tom Ogilvy


    "grime" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Trying to do some basic animation with an autoshape. I have a rectangle
    > that I am changing the size in steps. The problem is, it resizes the
    > bottom edge of the rectangle up instead of moving the top edge of the
    > rectangle down.
    >
    > here is my code:
    >
    > Code:
    > --------------------
    > For j = 1 To 200
    > rectheight = rectheight - 0.5
    > ActiveSheet.Shapes("Rectangle 1").Height = rectheight
    > For i = 1 To 100
    > DoEvents
    > Next i
    > Next j
    > --------------------
    >
    >
    > How do I tell VBA to resize my rectangle from the bottom up?
    >
    >
    > --
    > grime
    > ------------------------------------------------------------------------
    > grime's Profile:

    http://www.excelforum.com/member.php...o&userid=19227
    > View this thread: http://www.excelforum.com/showthread...hreadid=504923
    >




  3. #3
    Registered User
    Join Date
    02-01-2005
    Posts
    62
    My bad. I contradicted myself in my post.

    As I resize the rectangle, I want the bottom edge to stay in place and have the top edge move. Your code keeps the top edge aligned.

  4. #4
    Tom Ogilvy
    Guest

    Re: changing size of autoshape

    My mistake in reading.

    ltop = ActiveSheet.shapes("Rectangle 1").Top
    For j = 1 To 200
    rectheight = rectheight - 0.5
    ltop = ltop - 0.5
    Application.ScreenUpdating = False
    ActiveSheet.Shapes("Rectangle 1").Height = rectheight
    Activesheet.Shapes("Rectangle 1").Top = lTop
    Application.ScreenUpdating = True
    For i = 1 To 100
    DoEvents
    Next i
    Next j

    --
    Regards,
    Tom Ogilvy


    "grime" <[email protected]> wrote in message
    news:[email protected]...
    >
    > My bad. I contradicted myself in my post.
    >
    > As I resize the rectangle, I want the bottom edge to stay in place and
    > have the top edge move. Your code keeps the top edge aligned.
    >
    >
    > --
    > grime
    > ------------------------------------------------------------------------
    > grime's Profile:

    http://www.excelforum.com/member.php...o&userid=19227
    > View this thread: http://www.excelforum.com/showthread...hreadid=504923
    >




  5. #5
    Tom Ogilvy
    Guest

    Re: changing size of autoshape

    whoops, should be incrementing the top

    ltop = ActiveSheet.shapes("Rectangle 1").Top
    For j = 1 To 200
    rectheight = rectheight - 0.5
    ltop = ltop + 0.5
    Application.ScreenUpdating = False
    ActiveSheet.Shapes("Rectangle 1").Height = rectheight
    Activesheet.Shapes("Rectangle 1").Top = lTop
    Application.ScreenUpdating = True
    For i = 1 To 100
    DoEvents
    Next i
    Next j

    --
    Regards,
    Tom Ogilvy

    "Tom Ogilvy" <[email protected]> wrote in message
    news:%[email protected]...
    > My mistake in reading.
    >
    > ltop = ActiveSheet.shapes("Rectangle 1").Top
    > For j = 1 To 200
    > rectheight = rectheight - 0.5
    > ltop = ltop - 0.5
    > Application.ScreenUpdating = False
    > ActiveSheet.Shapes("Rectangle 1").Height = rectheight
    > Activesheet.Shapes("Rectangle 1").Top = lTop
    > Application.ScreenUpdating = True
    > For i = 1 To 100
    > DoEvents
    > Next i
    > Next j
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "grime" <[email protected]> wrote in

    message
    > news:[email protected]...
    > >
    > > My bad. I contradicted myself in my post.
    > >
    > > As I resize the rectangle, I want the bottom edge to stay in place and
    > > have the top edge move. Your code keeps the top edge aligned.
    > >
    > >
    > > --
    > > grime
    > > ------------------------------------------------------------------------
    > > grime's Profile:

    > http://www.excelforum.com/member.php...o&userid=19227
    > > View this thread:

    http://www.excelforum.com/showthread...hreadid=504923
    > >

    >
    >




  6. #6
    Registered User
    Join Date
    02-01-2005
    Posts
    62
    Yer the man, Tom. Thanks a ton.

+ 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