VBA super slow to execute in PP2007

  • Thread starter Thread starter martinPP
  • Start date Start date
M

martinPP

Code I've written for PP2003 runs super fast. In 2007 it crawls so slowly
that the task is non-functioning. Basically the VBA is used to draw boxes
which are formatted and when completed the slide is viewed. Any ideas?
 
Post your code, and let the experts (not me) have a look see.

--
Michael Koerner
MS MVP - PowerPoint


Code I've written for PP2003 runs super fast. In 2007 it crawls so slowly
that the task is non-functioning. Basically the VBA is used to draw boxes
which are formatted and when completed the slide is viewed. Any ideas?
 
This is the code. It uses two screens. The first is used to initialise some
variables. The second draws the boxes. The only code that really matters is
the Sub DrawBoxes. If the formatting is omitted from this then the boxes draw
fastish otherwise it c r a w l s. In 2003 it goes like the
clappers.

Public mySlide1, mySlide2 As Variant
Public black, white, red, yellow, blue As Long

Sub StartUp()

Set mySlide1 = ActivePresentation.Slides(1)
Set mySlide2 = ActivePresentation.Slides(2)

black = RGB(0, 0, 0)
white = RGB(255, 255, 255)
red = RGB(255, 0, 0)
yellow = RGB(255, 255, 128)
blue = RGB(51, 153, 255)

Test

End Sub

Sub Test()
ClearBoxes
GoToSlide 2
DrawBoxes
GoToSlide 2
End Sub

Sub ClearBoxes()

With mySlide2.Shapes
For intShape = .Count To 1 Step -1
With .Item(intShape)
If .Name <> "NEW" Then .Delete
End With
Next
End With

End Sub

Sub DrawBoxes()

With mySlide2

For Row = 1 To 9
For Col = 1 To 10

xpos = 60 + (Col - 1) * 32
ypos = 100 + 32 * (Row Mod 10)
myN = "B" & Col + 10 * ((Row - 1) Mod 10)

With .Shapes.AddShape(msoShapeRectangle, xpos, ypos, 24, 24)

.Name = myN

.Fill.ForeColor.RGB = blue

With .TextFrame.TextRange

.Text = myN

With .Font
.Name = "Arial"
.Size = 10
.Color.RGB = white
End With

End With

End With

Next Col
Next Row

End With

End Sub

Sub GoToSlide(mySlide)
With SlideShowWindows(1).View
.GoToSlide mySlide
End With
End Sub
 
Thanks for the tips, Steve, which I've implemented. No joy. Eliminating
formatting and NOT writing text to the boxes allows box drawing to take place
fast. Takes about 7 seconds otherwise.

I'm using a non-commercial trial version (Office 2007) - would this make a
difference? Can't see that it would.
 
have you included the suggestion re installing a test default
printer? That can cure a *known* cause for PPT getting the slows when
dealing
with text (entering, formatting).


Yes I've done that. Followed your instructions to the letter. It's clearly a
text problem. Unformatted text takes about 5 secs and formatting almost
doubles the time. How can a bug like this not be fixed BY NOW?
 
The code that you used is ALL I'm running. There are only two slides and
there need only be one. The whole file is less than 50kb.

Today I separated out the drawing of the shapes and the formatting. The
drawing zips along - no difference to PP2003. Introduce the formatting and it
chokes.

I'm running XP. Lots of memory and an Intel processor.The same code runs
effortlessly in PP2003. I haven't even saved the app in compatible mode (2007
and 2003) just in case.

If this code runs fast on your setup then there must be trouble on mine -
but what? There are no viruses on my machine as far as I know (checked with
AVG) no spyware (SpyBot).

I can send you the file if you think it'll help.
 
Steve and Martin --

If you feel comfortable sharing the file, I'd be more than happy to take a
look at it (Steve knows how to get it to me). Hopefully this is a known issue
but without having the file in front of me, I can't confirm that. If we don't
already have a bug filed, I would be more than happy to post one.

Thanks,
Bobby
 
That's fine by me, Bobby

Martin



bkolba said:
Steve and Martin --

If you feel comfortable sharing the file, I'd be more than happy to take a
look at it (Steve knows how to get it to me). Hopefully this is a known issue
but without having the file in front of me, I can't confirm that. If we don't
already have a bug filed, I would be more than happy to post one.

Thanks,
Bobby
 
That's OK by me, Bobby

Martin



bkolba said:
Steve and Martin --

If you feel comfortable sharing the file, I'd be more than happy to take a
look at it (Steve knows how to get it to me). Hopefully this is a known issue
but without having the file in front of me, I can't confirm that. If we don't
already have a bug filed, I would be more than happy to post one.

Thanks,
Bobby
 
That's OK by me, Bobby

Martin

bkolba said:
Steve and Martin --

If you feel comfortable sharing the file, I'd be more than happy to take a
look at it (Steve knows how to get it to me). Hopefully this is a known issue
but without having the file in front of me, I can't confirm that. If we don't
already have a bug filed, I would be more than happy to post one.

Thanks,
Bobby
 
Everytime I post on here I get an error message and then an invitation to
resend . . . so there are three are three of the same replies above.
 
Back
Top