Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VBA command to say "yes"/"no" to popup window

Hi,

Does anyone know what VBA command I could insert into my
Macro that would automatically select "yes" or "no" to an
Excel pop-up window?

So for example, I have a Macro which opens and closed
workbooks and moves data from one workbook to another. In
the process, I'll get an Excel window, which asks "do you
want to save" (or something along those lines). I then
click "No" and the Macro continues along its merry way. I
was wondering if I could insert VBA code at that junction
which would automatically select "No" to that prompt.

Please advise.

Thanks,

Manuel

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default VBA command to say "yes"/"no" to popup window

Hi Manuel

If you use this for example the workbook will be closed without saving

ThisWorkbook.Close SaveChanges:=False


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Manuel" wrote in message ...
Hi,

Does anyone know what VBA command I could insert into my
Macro that would automatically select "yes" or "no" to an
Excel pop-up window?

So for example, I have a Macro which opens and closed
workbooks and moves data from one workbook to another. In
the process, I'll get an Excel window, which asks "do you
want to save" (or something along those lines). I then
click "No" and the Macro continues along its merry way. I
was wondering if I could insert VBA code at that junction
which would automatically select "No" to that prompt.

Please advise.

Thanks,

Manuel



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default VBA command to say "yes"/"no" to popup window

Hi Manuel

You don't reply to a popup like that, you make sure there are none. Like
this:

Application.DisplayAlerts = False
'your code here
Application.DisplayAlerts = True

HTH. Best wishes Harald

"Manuel" skrev i melding
...
Hi,

Does anyone know what VBA command I could insert into my
Macro that would automatically select "yes" or "no" to an
Excel pop-up window?

So for example, I have a Macro which opens and closed
workbooks and moves data from one workbook to another. In
the process, I'll get an Excel window, which asks "do you
want to save" (or something along those lines). I then
click "No" and the Macro continues along its merry way. I
was wondering if I could insert VBA code at that junction
which would automatically select "No" to that prompt.

Please advise.

Thanks,

Manuel



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA command to say "yes"/"no" to popup window

It is possible to set the default value to no in the msgbox
The msg box definition is then
MsgBox("Do you want to save?", vbYesNo + vbDefaultButton2, "test1")

Greetz
Ikke


"Manuel" schreef in bericht
...
Hi,

Does anyone know what VBA command I could insert into my
Macro that would automatically select "yes" or "no" to an
Excel pop-up window?

So for example, I have a Macro which opens and closed
workbooks and moves data from one workbook to another. In
the process, I'll get an Excel window, which asks "do you
want to save" (or something along those lines). I then
click "No" and the Macro continues along its merry way. I
was wondering if I could insert VBA code at that junction
which would automatically select "No" to that prompt.

Please advise.

Thanks,

Manuel



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VBA command to say "yes"/"no" to popup window

Thanks, your suggestion may work for one part of the macro, but not for
others. Let me explain. The macro pulls (copies then pastes) data from
text files, then closes said text files. 3 times while running the
macro I receive the following message:

'FILE NAME' is not in Microsoft Excel 97 format. Do you want to save
your changes?

I manually click NO to these prompts.

I also receive a message that says the following:

A file named 'File Name' already exists in this location. Do you want
to replace it?

I manually click YES to this prompt (it's necessary that this particular
file is overwritten each time the macro runs).

So turning off the displays for the 1st message would probably resolve
prompt 1, but at prompt 2 I want to be able to click YES to overlay the
file, and I don't believe removing the prompts would accomplish this, or
would it?

I appreciate any help you can provide.

Manuel


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VBA command to say "yes"/"no" to popup window

Thanks for the suggestion, but I don't think it'll suit my needs. Let
me explain further, as I wasn't very clear before. The macro pulls
(copies then pastes) data from text files, then closes said text files.
3 times while running the macro I receive the following message:

'FILE NAME' is not in Microsoft Excel 97 format. Do you want to save
your changes?

I manually click NO to these prompts.

I also receive a message that says the following:

A file named 'File Name' already exists in this location. Do you want
to replace it?

I manually click YES to this prompt (it's necessary that this particular
file is overwritten each time the macro runs).

So I'm not sure the command you suggested would work becaue I'm dealing
with closing text files after I've imported data into Excel, and not
Workbooks. Do you have any other suggestion?

I appreciate any help you can provide.

Manuel




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default VBA command to say "yes"/"no" to popup window

"Manuel Soares" skrev i melding
...

'FILE NAME' is not in Microsoft Excel 97 format. Do you want to save
your changes?

I manually click NO to these prompts.


Hi Manuel

The correct syntax is impossible to guess without seeing your code, but I'll
try.
Put
Workbooks("FILE NAME").Saved = True
immediately before
Workbooks("FILE NAME").Close


I also receive a message that says the following:

A file named 'File Name' already exists in this location. Do you want
to replace it?

I manually click YES to this prompt (it's necessary that this particular
file is overwritten each time the macro runs).


Application.DisplayAlerts = False
'either :
Workbooks("FILE NAME").Save
'or :
Workbooks("WHATEVER").SaveAs "FILE NAME"
Application.DisplayAlerts = True
Workbooks("FILE NAME").Close

Don't just participate in USENET...get rewarded for it!


You get paid for receiving our free assistance ?

HTH. Best wishes Harald



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default VBA command to say "yes"/"no" to popup window


"Manuel Soares" wrote in message
...
Thanks for the suggestion, but I don't think it'll suit my needs. Let
me explain further, as I wasn't very clear before. The macro pulls
(copies then pastes) data from text files, then closes said text files.
3 times while running the macro I receive the following message:

'FILE NAME' is not in Microsoft Excel 97 format. Do you want to save
your changes?

I manually click NO to these prompts.

I also receive a message that says the following:

A file named 'File Name' already exists in this location. Do you want
to replace it?

I manually click YES to this prompt (it's necessary that this particular
file is overwritten each time the macro runs).

So I'm not sure the command you suggested would work becaue I'm dealing
with closing text files after I've imported data into Excel, and not
Workbooks. Do you have any other suggestion?

I appreciate any help you can provide.

Manuel


You can suppress these messages by using the command
Application.DisplayAlerts = False

dont forget to turn them on again when you are done :)

Keith




----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
freeze window creates multiple "views" suffixed with ":n" dgaex001 Excel Discussion (Misc queries) 5 March 22nd 06 05:28 PM


All times are GMT +1. The time now is 11:51 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"