+ Reply to Thread
Results 1 to 4 of 4

Stepping Problem,

  1. #1
    ben
    Guest

    Stepping Problem,

    I know I posted this earlier, but the response I recieved did not help any.
    Though I did appreciate the response.

    Stepping through a program will achieve the desired results, but running it
    normally will error out.

    First, a Worksheet Change Event is recieved, this in turns calls a Sub to
    add an AutoShape to a worksheet.
    If code is allowed to run normally I will always recieve a
    1004 Application-Defined or Object Defined error at the line that actually
    ADDS the shape

    Set sh = wks.Shapes.AddShape(msoShapeDownArrow, 354.75, 162 + (rown * 21),
    24, 30)

    wks is passed as an argument to the sub from the worksheet change event and
    sh is a shared public variable as Shape

    when stepping the code does not error out.
    Anyone know why this might be doing so?









    --
    When you lose your mind, you free your life.

  2. #2
    Steve
    Guest

    Re: Stepping Problem,

    Try this, I take it rown is the row number
    this worked fine for me

    Dim shp As Shape

    Private Sub Workbook_SheetChange(ByVal sh As Object, ByVal Target As Range)

    Set shp = sh.Shapes.AddShape(msoShapeDownArrow, 354.75, 162 +ActiveCell.Row
    * 21, 24, 30)

    End Sub



    "ben" <[email protected](remove this if mailing direct)> wrote in message
    news:[email protected]...
    >I know I posted this earlier, but the response I recieved did not help any.
    > Though I did appreciate the response.
    >
    > Stepping through a program will achieve the desired results, but running
    > it
    > normally will error out.
    >
    > First, a Worksheet Change Event is recieved, this in turns calls a Sub to
    > add an AutoShape to a worksheet.
    > If code is allowed to run normally I will always recieve a
    > 1004 Application-Defined or Object Defined error at the line that actually
    > ADDS the shape
    >
    > Set sh = wks.Shapes.AddShape(msoShapeDownArrow, 354.75, 162 + (rown * 21),
    > 24, 30)
    >
    > wks is passed as an argument to the sub from the worksheet change event
    > and
    > sh is a shared public variable as Shape
    >
    > when stepping the code does not error out.
    > Anyone know why this might be doing so?
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > --
    > When you lose your mind, you free your life.




  3. #3

    Re: Stepping Problem,

    your code works well,
    but shape is not visible.
    so "shp.Visible = msoTrue" is required

    Best regards
    sjoo


  4. #4
    ben
    Guest

    Re: Stepping Problem,

    This question was actually finally presented with a work around in a previous
    post, it seems that other people have add this issue and had to have excel
    Select something else (doesn't matter what) before creating the shape.

    --
    When you lose your mind, you free your life.


    "[email protected]" wrote:

    > your code works well,
    > but shape is not visible.
    > so "shp.Visible = msoTrue" is required
    >
    > Best regards
    > sjoo
    >
    >


+ 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