PC Review


Reply
Thread Tools Rate Thread

Check an object reference

 
 
=?Utf-8?B?WFA=?=
Guest
Posts: n/a
 
      19th Oct 2007
Using Office 2003 and Windows XP;

I have an object reference to a file, call it "goFile".

I need to be able to do two things with this reference:

1. Determine if the file it is refering to is open.

2. Determine if the reference is set to anything.

Could someone please post example code that illustrates these two things?

Thanks much in advance.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      19th Oct 2007
if gofile is not nothing then
For Each wbk In Workbooks
if wbk.name = gofile then
' Enter code here
end if
next wbk
end if

"XP" wrote:

> Using Office 2003 and Windows XP;
>
> I have an object reference to a file, call it "goFile".
>
> I need to be able to do two things with this reference:
>
> 1. Determine if the file it is refering to is open.
>
> 2. Determine if the reference is set to anything.
>
> Could someone please post example code that illustrates these two things?
>
> Thanks much in advance.

 
Reply With Quote
 
JP
Guest
Posts: n/a
 
      19th Oct 2007
Hello,

Sorry to butt in but I think the actual syntax should be:

If Not gofile Is Nothing


HTH,
JP


On Oct 19, 5:50 pm, Joel <J...@discussions.microsoft.com> wrote:
> if gofile is not nothing then
> For Each wbk In Workbooks
> if wbk.name = gofile then
> ' Enter code here
> end if
> next wbk
> end if
>
>
>
> "XP" wrote:
> > Using Office 2003 and Windows XP;

>
> > I have an object reference to a file, call it "goFile".

>
> > I need to be able to do two things with this reference:

>
> > 1. Determine if the file it is refering to is open.

>
> > 2. Determine if the reference is set to anything.

>
> > Could someone please post example code that illustrates these two things?

>
> > Thanks much in advance.- Hide quoted text -

>
> - Show quoted text -



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use a Variable to Reference a Check Box Object Ken Hudson Microsoft Excel Programming 7 8th May 2009 11:12 PM
when i reference a com object by regsvr32 it then find it in the COM tab, it works ok. but when i reference a com object by referencing the .dll file i get this error in my C# application: DR Microsoft Dot NET 1 19th Jan 2008 05:01 PM
when i reference a com object by regsvr32 it then find it in the COM tab, it works ok. but when i reference a com object by referencing the .dll file i get this error in my C# application: DR Microsoft C# .NET 1 18th Jan 2008 08:18 AM
when i reference a com object by regsvr32 it then find it in the COM tab, it works ok. but when i reference a com object by referencing the .dll file i get this error in my C# application: DR Microsoft Dot NET Framework 0 18th Jan 2008 03:22 AM
How does one check if an object's reference is NULL? Karen Hill Microsoft C# .NET 4 15th Sep 2006 08:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:38 AM.