Excel VBA

G

Guest

I've set up a macro in Excel to:

1. Open a .txt file via the Text Import Wizard
2. Copy the data and paste into another worksheet
3. Close the .txt file

Three different Alert Messages pop up:

1. The first indicates the .txt is not in a recognizable format, and if I
want to view anyway..... to which i click 'OK'
2. The second asks if I want to save the .txt file...... 'No'
3. The third asks if I want to move the copied data onto the
clipboard...... 'No'

How do I set up the macro to automatically answer the alerts?
 
G

Guest

application.DisplayAlerts = False

' your code that raises a message

Application.DisplayAlerts = True

this will suppress most messages - but you will have to test it with your
messages.
 
B

Bob Phillips

Precede the code with

Application.DisplayAlerts = False

and reset afterwards.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
G

Guest

Thanks Tom.



Tom Ogilvy said:
application.DisplayAlerts = False

' your code that raises a message

Application.DisplayAlerts = True

this will suppress most messages - but you will have to test it with your
messages.
 
G

Guest

Thanks Bob

Bob Phillips said:
Precede the code with

Application.DisplayAlerts = False

and reset afterwards.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top