If you hit Enter (or click any where else in your mod ule) after typing
msoShape16pointStar
, you will get the er ror in Figure 9.1, and the line with
the er ror will turn red. In this case, we are miss ing the close pa renthesis, so we
can add it:
Sub AddStar()
ActivePresentation.SlideShowWindow.View.Slide.Shapes.AddShape _
(msoShape16pointStar)
End Sub
Now when you hit Enter, the line doesn’t turn red. Does that mean that it works?
No, it does not. But we’re ready to try it out to see if it works.
Create a but ton
and tie it to the pro cedure
AddStar
. Go to Slide Show
View and click on your but ton. No news is bad news. The VBA Ed itor (or more
accurately, the VBA com piler) could n’t find anything wrong as you typed, but
when VBA
tried to run the pro cedure, it could n’t fig ure it out, so it just gave up.
Unfortunately, we don’t have any more clues as to what is wrong. How-
ever, since we are adding a shape, we might re member
that we need to tell VBA
where the shape should go and how big it should be:
Do'stlaringiz bilan baham: