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.
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
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.
I served in the Army during Desert Storm. I never went to Germany myself but I knew countless people that served a tour there. I heard nothing but the best stories. Everyone talked about Germany about nothing but good times (maybe except the cold for some). Many wanted to move there one day. It's definitely on my vacation bucket list! I'm gonna get some of that good German beer for sure!
Oh. My dad severed a tour in Germany too during the Vietnam War. Lot's of stories from him too, including many bar fights with Germans. He was a little guy back in those days but learned a lot about fighting and wasn't someone to mess with after much experience....lol. Needless to say he had to get many teeth fixed later down the road.
Oh yes, we Americans got a lot of cool places to drink too. There's some bars that have all beer from all over the world. Much variety here too. Most people party with Bud light, Natural Lite, Bud, Coors, and of course Miller High Life! When that's not enough we borrow the spirits from Mexico (Tequila), Tennessee (Jack Daniels), Vodka, Kentucky (Jim Beam), Puerto Rico (Rum), Canadian Whiskey, and so on. Basically a big "melting pot"! Bottoms up!
Steve said: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.
Yea. Sure different from County to County. They county I live in doesn't sell liquor, only beer.