Disappearing act!

G

Guest

I use this code to test colors, etc. in a workbook which is for testing
purposes only.

Sub TestShp()
Dim MyDocument
Set MyDocument = Worksheets(2)
MyDocument.Shapes.AddShape msoShape32pointStar, 250, 250, 100, 200
MyDocument.Shapes(1).Fill.ForeColor.RGB = RGB(255, 100, 100)
Set newWordArt =
MyDocument.Shapes.AddTextEffect(PresetTextEffect:=msoTextEffect1,
Text:="Test", fontName:="Arial Black", fontSize:=36, FontBold:=msoFalse,
FontItalic:=msoFalse, Left:=10, Top:=10)
Counter = 0
Do
With MyDocument.Shapes(1)
.IncrementLeft Counter + 70
.IncrementTop (Counter * -1) + (-50)
.IncrementRotation 30
End With
Counter = Counter + 25
WaitTime
Loop While Counter < 100
Worksheets(2).Shapes(2).Delete
Worksheets(2).Shapes(1).Delete
End Sub

The mystery is this. The msoShape suddenly quit appearing while the WordArt
TextEffect worked just fine.

Part two of the mystery is that it only occurs in this workbook. I can copy
this code to any other workbook and it works fine.

Can this be attributed to a corrupted file or is there some other code that
I might have run that would have turned off the msoShape visible properties.
I have checked all of the code in the module and cannot find anything that
sets the visible properties to false. Does anyone have a clue?

This was previously posted without the code and no one responded.
 
G

Guest

Waittime just raises an error for me.

since you delete the shapes at the bottom, perhaps it just creates them and
deletes them.
 
G

Guest

Sorry bout that Tom. The WaitTime is a function that creates a delay
interval so that the Shape image will display long enough for visual effect.
You can take that out and put a message box in its place to halt the macro
long enough to look at it. You should see the image on your screen. I can
see it in any other workbook but that particular one and it is only the
msoShape that does it. That is why the anomaly is so mystifying. If none of
the shapes images showed, I could probably find a reason, but when only one
type of shape image does it, I don't even know where to start looking. Are
there any technical people that I could report this to that might have a clue?
 
G

Guest

I couldn't see anything until I did this:

Sub TestShp()
Dim MyDocument
Set MyDocument = Worksheets(2)
MyDocument.Shapes.AddShape msoShape32pointStar, 250, 250, 100, 200
MyDocument.Shapes(1).Fill.ForeColor.RGB = RGB(255, 100, 100)
Set newWordArt =
MyDocument.Shapes.AddTextEffect(PresetTextEffect:=msoTextEffect1,
Text:="Test", FontName:="Arial Black", FontSize:=36, FontBold:=msoFalse,
FontItalic:=msoFalse, Left:=10, Top:=10)
' Exit Sub
Counter = 0
Do
DoEvents
With MyDocument.Shapes(1)
.IncrementLeft Counter + 70
.IncrementTop (Counter * -1) + (-50)
.IncrementRotation 30
End With
Application.ScreenUpdating = False
Application.ScreenUpdating = True
DoEvents
Counter = Counter + 25
i = 0
Do While i < 1000000

i = i + 1
Loop
Loop While Counter < 100
Worksheets(2).Shapes(2).Delete
Worksheets(2).Shapes(1).Delete
End Sub
 
G

Guest

One other thing about the msoShape. It is there, but not visible. The
selection frame appears with the node handles when you click in the location
 
G

Guest

I ran the code you posted in that workbook and it does the same thing. I can
see the word "TEST" but the 32point star is not visible. It is there, but
not visible. I can click on the area where it is supposed to be visible and
the handles appear but no image. There must be a switch flipped somewhere
that I can't find. Thanks for your time, Tom. This appears to be either a
technical problem or operator error.
 
T

Tom Ogilvy

As long as the visible property is true, I don't think there is a switch
that is flipped.

Excel just doesn't redraw very well
 
G

Guest

I marked the workbook as corrupt and moved all the code I want to keep to
another workbook. I have never had anything like this before. There is
usually a setting somewhere that I have inadvertantly changed, but I have
checked every setting and they are all OK. There is nothing that I know of,
except the image code itself, that would affect only the msoShape. I tried
to insert autoshape manually and it still won't appear unless I go to format
autoshape and add lines and fill manually. This one is blowing my mind. It
is not a code problem. Something in that workbook was changed that prevents
the image from displaying. I am not going to delete the workbook until I
find the problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top