ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to test if a workbook variable is valid (https://www.excelbanter.com/excel-programming/347514-how-test-if-workbook-variable-valid.html)

Jean-Pierre Bidon

How to test if a workbook variable is valid
 
Hi,
When using a variable of type workbook in an expression, it is necessary to
test if its content is valid. For instance that it is not "nothing".
However syntaxes like "if wb < nothing then ..." or "if not wb=nothing then
...." do not work.
Is there any solution, possibly with a different approach.
Thank you in advance.

Jean-Pierre B



Peter Rooney

How to test if a workbook variable is valid
 
Jean-Pierre,

How about IF LEN(VariableName) = 0 (to test for a blank string)

Regards

Pete


"Jean-Pierre Bidon" wrote:

Hi,
When using a variable of type workbook in an expression, it is necessary to
test if its content is valid. For instance that it is not "nothing".
However syntaxes like "if wb < nothing then ..." or "if not wb=nothing then
...." do not work.
Is there any solution, possibly with a different approach.
Thank you in advance.

Jean-Pierre B




Jean-Pierre Bidon

How to test if a workbook variable is valid
 
Thanks for your help, but the len() function requires an argument of type
string .
Actually, I got the answer in the mean time.
The syntax I used at first was not good "if wb < nothing then ..." . The
right syntax is "if wb is nothing then ...".
Thanks.
Best regards.
Jean-Pierre

"Peter Rooney" a écrit dans le
message de news: ...
Jean-Pierre,

How about IF LEN(VariableName) = 0 (to test for a blank string)

Regards

Pete


"Jean-Pierre Bidon" wrote:

Hi,
When using a variable of type workbook in an expression, it is necessary
to
test if its content is valid. For instance that it is not "nothing".
However syntaxes like "if wb < nothing then ..." or "if not wb=nothing
then
...." do not work.
Is there any solution, possibly with a different approach.
Thank you in advance.

Jean-Pierre B






Peter Rooney

How to test if a workbook variable is valid
 
Oops - that'll teach me to read the question properly - it's a bit late in
the day.

Sorry

Pete



"Jean-Pierre Bidon" wrote:

Thanks for your help, but the len() function requires an argument of type
string .
Actually, I got the answer in the mean time.
The syntax I used at first was not good "if wb < nothing then ..." . The
right syntax is "if wb is nothing then ...".
Thanks.
Best regards.
Jean-Pierre

"Peter Rooney" a écrit dans le
message de news: ...
Jean-Pierre,

How about IF LEN(VariableName) = 0 (to test for a blank string)

Regards

Pete


"Jean-Pierre Bidon" wrote:

Hi,
When using a variable of type workbook in an expression, it is necessary
to
test if its content is valid. For instance that it is not "nothing".
However syntaxes like "if wb < nothing then ..." or "if not wb=nothing
then
...." do not work.
Is there any solution, possibly with a different approach.
Thank you in advance.

Jean-Pierre B








All times are GMT +1. The time now is 07:28 PM.

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