Hi.
This has been around for a long time. I posted a long time ago on Oberon Place but it's still there.
This causes crash in all versions.It's still here in X6.
Sub test() Dim s As Shape, sr As New ShapeRange sr.Add sEnd Sub
Yes I know s should not be nothing but sometimes when testing code you might lose your object or it doesn't even get set for reason of other errors from either program glitches or user coding error. This will cause unnecessary program crashes when one is testing/debugging code. Please fix so it doesn't crash.
It's more stable similar function AddRange can take anything without causing the program to crash.
~John
Caused me some headaches too, so I do things like this...
If Not s Is Nothing then sr.Add s
...or more often than not I send it to an error handler to help with debugging or a prevent a crash.
Steve said:If Not s Is Nothing then sr.Add s
In cases where I had to loop through a dynamic ShapeRange, even "Not s Is Nothing" didn't work for me. When I had Shapes deleted from a ShapeRange during runtime, the Locals window in the VBA editor was constantly saying "The referenced Shape doesn't exist anymore", so I used
If Not s Is Empty Then ...
I assume a shape is passed by reference in a ShapeRange, so it was better to check if the referenced object (the deleted Shape) is empty rather than nothing, cause the reference pointer was still there, but no object to fill it. Maybe this can help anyone in the future.
mo said:In cases where I had to loop through a dynamic ShapeRange, even "Not s Is Nothing" didn't work for me. When I had Shapes deleted from a ShapeRange during runtime, the Locals window in the VBA editor was constantly saying "The referenced Shape doesn't exist anymore", so I used
Me too. I think I recall this not working all the time.
mo said:If Not s Is Empty Then ...
Cool. Never tried that.
RunFlaCruiser said:I think I recall this not working all the time.
I would not suggest to recall it. VBA should not crash on this anyway. At least logically:
It is like giving a bag (the variable) of cookies (the internal object) to my girlfriend (the procedure or function). She doesn't have the right to separate from me (the crash), if the cookie bag is empty. A slap (an error message) would do it.
HI Mo.
Can I have some of that beer too!
lol.
ROFL
German beer is quite good, but not for the purpose I think you ascribe to me...
Cheers
I bet it is, and strong. Probably better than my Natural Lite as long as it's not warm beer.
My wife got me a 6 pack of Dos Equis for my birthday. Good stuff!
mo said:German beer is quite good...
I was fortunate enough to visit Germany a few years back. Was with some guys that walked up to a stand outside of a bar where a waitress quickly walked up with a wooden case full of glasses of brew. Had a good time that night. They do it a bit different here in the US.
LOL, I'm sure they do it a bit different in the US, but that thing with the wooden case is nothing we germans are used to get if we order a beer, honestly. It's called "beer meter", and it's a gag, mostly in discotheques or open air pubs. There's also a "beer tower" available in some discotheques, a plexiglass tube with a beer tab below. I can imagine there are some similar inventions in some places in the US too. Would be hard for me to believe the germans are the only 'creative' people when it comes to get royally drunk...
I probably should be more specific than just the US, because it is different here in every state. In Kansas you cannot buy packaged alcohol on Sunday's and can only buy drinks in establishments that derive more than 50% of their income from food sales on that day of the week. You can't by alcohol in grocery stores at anytime, except for watered down beer that can't contain more than 3.2 percent alcohol. There are no open air bars unless they are completely enclosed in a 6 foot privacy fence and that was only recently allowed when they banned smoking in doors at any public place. There are some counties, not just in Kansas that do not allow alcohol sales at all and are called "dry" counties. It is considerably more liberal in other states and even more tight in some others.
The only place you can really get creative here to get totally smashed is at home and then you better not leave your house. With growng up with that, it made my European trip that much more interesting.