Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Does the object already have a value set?

Hi,

I have an workbook object named "RespWkbook"

I would like to check whether I have already assigned a workbook to it.
If so then I would like to close the assign that workbook (because it
has become old for me) and set a new workbook to RespWkBook.

I tried

if Not(IsNull(RespWkbook)) then RespWkbook.close
set RspWbook = "//hari/desktop/NewWrkBook.xls"

But it didnt work

I also tried

if Not(Isempty(RespWkbook)) then RespWkbook.close
set Respwkbook = "//hari/desktop/NewworkBook.xls"

again it is not working.

Whats the right syntax for checking whether an object has value Nothing
or not and be able to do the operation I want to do?

Rgards,
Hari
India

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Does the object already have a value set?

Try

If RespWkbook Is Nothing Then
' no workbook assigned
Else
' workbook assigned
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"Hari" wrote in message
oups.com...
Hi,

I have an workbook object named "RespWkbook"

I would like to check whether I have already assigned a
workbook to it.
If so then I would like to close the assign that workbook
(because it
has become old for me) and set a new workbook to RespWkBook.

I tried

if Not(IsNull(RespWkbook)) then RespWkbook.close
set RspWbook = "//hari/desktop/NewWrkBook.xls"

But it didnt work

I also tried

if Not(Isempty(RespWkbook)) then RespWkbook.close
set Respwkbook = "//hari/desktop/NewworkBook.xls"

again it is not working.

Whats the right syntax for checking whether an object has value
Nothing
or not and be able to do the operation I want to do?

Rgards,
Hari
India



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Does the object already have a value set?

Chip,

Thanx a lot. It works nicely.

Regards,
Hari
India

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2 Label Options - Forms Object vs Control Box Object Awrex Excel Discussion (Misc queries) 3 July 17th 09 07:10 PM
Option button object proeprties or object not found in vba Pete Straman S via OfficeKB.com Excel Programming 0 August 31st 05 05:49 PM
Confusion about how the Window object fits into the Excel object model Josh Sale Excel Programming 11 April 15th 05 06:08 PM
returning pivottable object from a range object Grant Excel Programming 2 September 27th 04 02:22 AM
Range object to Array object conversion Alan Beban[_3_] Excel Programming 0 August 1st 03 01:24 AM


All times are GMT +1. The time now is 10:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"