PC Review


Reply
Thread Tools Rate Thread

activeworkbook and thisworkbook

 
 
salgud
Guest
Posts: n/a
 
      15th Jul 2008
At the beginning of a macro I'm writing, I'm trying to test to make sure
that the activeworkbook is not the one the macro is in. I put this line in:

If ActiveWorkbook = ThisWorkbook Then

followed by a message box to the user. But I'm getting an "Object doesn't
support this property or method" error on this line. How do I text this
correctly?
Thanks again!
 
Reply With Quote
 
 
 
 
Per Jessen
Guest
Posts: n/a
 
      15th Jul 2008
On 16 Jul., 00:08, salgud <spamboy6...@comcast.net> wrote:
> At the beginning of a macro I'm writing, I'm trying to test to make sure
> that the activeworkbook is not the one the macro is in. I put this line in:
>
> If ActiveWorkbook = ThisWorkbook Then
>
> followed by a message box to the user. But I'm getting an "Object doesn't
> support this property or method" error on this line. How do I text this
> correctly?
> Thanks again!


Hi

Try this:

If ThisWorkbook.Name = ActiveWorkbook.Name Then

Regards,
Per
 
Reply With Quote
 
Lars-Åke Aspelin
Guest
Posts: n/a
 
      15th Jul 2008
On Tue, 15 Jul 2008 16:08:33 -0600, salgud <(E-Mail Removed)>
wrote:

>At the beginning of a macro I'm writing, I'm trying to test to make sure
>that the activeworkbook is not the one the macro is in. I put this line in:
>
>If ActiveWorkbook = ThisWorkbook Then
>
>followed by a message box to the user. But I'm getting an "Object doesn't
>support this property or method" error on this line. How do I text this
>correctly?
>Thanks again!



Try this:

If ActiveWorkbook.Name = ThisWorkbook.Name Then

Hope this helps / Lars-Åke
 
Reply With Quote
 
salgud
Guest
Posts: n/a
 
      15th Jul 2008
On Tue, 15 Jul 2008 15:16:04 -0700 (PDT), Per Jessen wrote:

> If ThisWorkbook.Name = ActiveWorkbook.Name Then


Got it. Thanks!
 
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
XL2003 - ThisWorkbook.VBProject.VBComponents("ThisWorkbook").CodeModule PCLIVE Microsoft Excel Programming 0 12th Jan 2009 07:06 PM
Excel is Ignoring ThisWorkbook.Save event after Thisworkbook.Close call John Fuller Microsoft Excel Programming 5 30th Aug 2006 09:57 PM
Where is ThisWorkbook.Sheets("xx") ?? Unable to resolve 'ThisWorkbook' :: Interop to Excel Eric W Microsoft VB .NET 4 21st Mar 2006 11:13 AM
ThisWorkbook/ActiveWorkbook =?Utf-8?B?Sm9obiBLZWl0aA==?= Microsoft Excel Programming 2 8th Feb 2006 10:35 PM
ThisWorkbook vs. ActiveWorkbook? JK Microsoft Excel Programming 5 19th Apr 2005 07:54 AM


Features
 

Advertising
 

Newsgroups
 


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