PC Review


Reply
Thread Tools Rate Thread

Changing default response of an alert through vba

 
 
Raj
Guest
Posts: n/a
 
      10th Jun 2008
Hi,

To avoid an alert being displayed when an open workbook is attempted
to be re-opened, I am using the following code:

On Error Resume Next
Application.DisplayAlerts = False
Workbooks.Open rspdir & rspstring1

This works fine and the alert display is suppressed. But the default
response of the alert ie. "Yes" pen the workbook is used. I want
the response "No" to be used ie. I do not want the workbook to be
opened again if the workbook is already open.

Can the default response of an alert be changed when the displayalerts
property is set to false?

If not, is there any other code I can use to open a workbook only if
it is not open?

Thanks in advance for the help.

Regards,
Raj
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      10th Jun 2008
Test if the workbook is open if so don't even try to open it

On Error Resume Next
Set wb = Workbooks("Some workbook.xls")
On Error Goto 0
If wb is Nothing Then

eet wb=Workbooks.Open("Some workbook.xls")
End If

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Raj" <(E-Mail Removed)> wrote in message
news:2875f0ad-5f5d-4a98-bfc1-(E-Mail Removed)...
> Hi,
>
> To avoid an alert being displayed when an open workbook is attempted
> to be re-opened, I am using the following code:
>
> On Error Resume Next
> Application.DisplayAlerts = False
> Workbooks.Open rspdir & rspstring1
>
> This works fine and the alert display is suppressed. But the default
> response of the alert ie. "Yes" pen the workbook is used. I want
> the response "No" to be used ie. I do not want the workbook to be
> opened again if the workbook is already open.
>
> Can the default response of an alert be changed when the displayalerts
> property is set to false?
>
> If not, is there any other code I can use to open a workbook only if
> it is not open?
>
> Thanks in advance for the help.
>
> Regards,
> Raj



 
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
Rule and Alert not sending response TotallyConfused Microsoft Outlook Discussion 3 2nd Sep 2009 10:34 PM
Blocking Security Alert during Response.Redirect dougloj Microsoft ASP .NET 2 1st Apr 2006 09:24 PM
New Mail Desktop Alert (default Inbox only) Change Default DrLargePants Microsoft Outlook Discussion 1 19th Aug 2004 11:08 AM
Change appointment response default "Send the response now" to... =?Utf-8?B?SmFwYW56?= Microsoft Outlook Calendar 0 19th May 2004 01:31 PM
Re: PSS Security Response Team Alert - New Worm: Nachi, Blaster-D, Welchia Donald Ross Windows XP General 0 19th Aug 2003 01:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:46 AM.