+ Reply to Thread
Results 1 to 5 of 5

Results differ when running code with and without a BreakPoint

  1. #1
    Registered User
    Join Date
    01-25-2007
    Posts
    2

    Results differ when running code with and without a BreakPoint

    Hi,

    New to this forum, so had a good search first to see if I can find anything similar, but can't find anything that fixes the problem!

    The problem: I am using VBA to generate some charts on a Worksheet from data held in another Workbook. Everything works great - formatting, the works - but only when stepping through with the VBA Debugger or setting a BreakPoint!! If I run the code without it stopping, the format of the chart is corrupt.

    The point of failure appears to be associated with changes to the "PlotArea". If a breakpoint is set on changing, say the "Top" parameter, then run is clicked again, the chart is fine!

    The code section is:

    Please Login or Register  to view this content.
    I commented out the assignments from variables - just to be REALLY sure!!

    Any help would be greatly appreciated - this is becoming a REAL pain!!
    Colin, the Barley Biker

    Excel 2003

  2. #2
    Forum Contributor
    Join Date
    01-24-2007
    Location
    Southampton, UK
    Posts
    137
    Not sure exactly what the issue is, but can suggest -

    (a) run the code wrapped between Application.Screenupdating = False and Application.Screenupdating = True statements, in case the display simply cannot keep up with the rapid changes to the chart;

    (b) try inserting a piece of code to create a pause between each change to see if this allows the chart to catch up with the changes e.g. -

    Dim x As Variant
    x = Now: While Now <= x: Wend


    This will create a pause of about a second or less.

    (c) if you have error trapping engaged (e.g. On Error Resume Next statement somewhere), try running your code without this to see if there is an error somewhere.

  3. #3
    Registered User
    Join Date
    01-25-2007
    Posts
    2
    Thanks Loz.

    Screen Updating is off and I haven't enabled the error trapping yet.

    I hadn't thought of putting a slug in to allow the charts to catch up. I'll give it a go tomorrow (don't have the lastest version of the code with me today).

    Thanks for the (only!) input - I'll let you know how I get on.

  4. #4
    Registered User
    Join Date
    08-21-2015
    Location
    netherlands
    MS-Off Ver
    2013
    Posts
    1

    Re: Results differ when running code with and without a BreakPoint

    Hello,

    I'm also experiencing the same error in Excel 2013. running the code with breakpoints actually executes the code. Without breakpoints the code seems to be ignored:

    chrt.PlotArea.InsideTop = 54
    chrt.PlotArea.InsideLeft = 42
    chrt.PlotArea.InsideHeight = 380
    chrt.PlotArea.InsideWidth = 516

    Changing the screenupdating is not fixing this error.

    I'd appriciate some help.

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Results differ when running code with and without a BreakPoint

    Hi, Machinehead33,

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ 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