Hi All,
I have seen a few similar queries out there but none of them seem to solve my problem:
I have a dashboard which contains a series of charts. I have written some code which is triggered by clicking on a chart and which then causes that chart to increase in size -- i.e. zooming in on it. Clicking the enlarged chart then reduces it back down to its original size. This works like a charm in Excel07 but I am attempting to make this work across both 03 and 07 and, in the former, the chart increases in size correctly (although the textboxes & legend positions are wrong) but on clicking a second time the dimensions of plot area reduce by 4 rather than 2 -- i.e. it ends up half the size it should be.
When I step through the code, however, I cannot replicate this and it works perfectly as it should.
I have identified the following sub as the culprit (the size of the chart object itself is controlled elsewhere, at which point the gobal variable 'Large' is set to True if the chart has just been increased in size, otherwise False)
I have stripped away everything unnecessary to complete this single action and I still cannot see why it will only work when stepping through the code. I tried to put a 1sec wait in prior to the PlotArea resize but that didn't seem to make any difference.Sub ActiveResize() Dim Multi As Double ActiveSheet.Unprotect With ActiveChart If Large Then Multi = 2 Else Multi = 0.5 End If With .PlotArea .Height = .Height * Multi .Top = .Top * Multi .Width = .Width * Multi .Left = .Left * Multi End With If .HasLegend Then With .Legend .Height = .Height * Multi .Top = .Top * Multi .Width = .Width * Multi .Left = .Left * Multi .Font.Size = .Font.Size * Multi End With End If For m = 1 To .Shapes.Count With .Shapes(m) .Height = .Height * Multi .Top = .Top * Multi .Width = .Width * Multi .Left = .Left * Multi If Application.Version > 11 Then .TextEffect.FontSize = .Shapes(m).TextEffect.FontSize * Multi Else .TextFrame.Characters.Font.Size = .TextFrame.Characters.Font.Size * Multi End If End With Next m End With End Sub
Does anyone have any suggestions as to why this is happening and how to resolve it? It's pretty urgent
Many thanks,
AdLoki
I haven't solved this problem yet but in case anyone has a similar issue, I think it relates to Excel 03's AutoScaling of plot areas, which (as far as I can tell) cannot be overwritten or edited.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks