ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Testing object value (https://www.excelbanter.com/excel-programming/441368-testing-object-value.html)

mooresk257

Testing object value
 
I am working on setting up some code to test whether an image is loaded in an
image box:

I use this to test to see if there is no image loaded:

If Worksheets("Sheet1").OLEObjects("Image2").Object.P icture Is Nothing Then

How would I write this line to test if there IS an image?

Thanks!

Rick Rothstein

Testing object value
 
Try this...

If Not Worksheets("Sheet1").OLEObjects("Image2").Object.P icture Is Nothing
Then

--
Rick (MVP - Excel)



"mooresk257" wrote in message
...
I am working on setting up some code to test whether an image is loaded in
an
image box:

I use this to test to see if there is no image loaded:

If Worksheets("Sheet1").OLEObjects("Image2").Object.P icture Is Nothing
Then

How would I write this line to test if there IS an image?

Thanks!



mooresk257

Testing object value
 
Thanks Rick - a double negative equals a positive - and it works perfectly!

"Rick Rothstein" wrote:

Try this...

If Not Worksheets("Sheet1").OLEObjects("Image2").Object.P icture Is Nothing
Then

--
Rick (MVP - Excel)



"mooresk257" wrote in message
...
I am working on setting up some code to test whether an image is loaded in
an
image box:

I use this to test to see if there is no image loaded:

If Worksheets("Sheet1").OLEObjects("Image2").Object.P icture Is Nothing
Then

How would I write this line to test if there IS an image?

Thanks!


.



All times are GMT +1. The time now is 06:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com