Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Getting rid of Prompts in a macro

Hi Folks,
I've got a big macro, several tied into one. However, when running the macro the prompts always come up one asks do you want to save, "YES" "NO" which I'd like it automatically save with out the prompt. Then another on comes on I don't want to save. Here's the code.
ActiveWorkbook.SaveAs Filename:="C:\otd\data\compile\International.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
ActiveWorkbook.Close
I suppose when closing the active workbook the prompt comes up asking me to save and I don't want to save the second one. But also do not want the prompt to show.
Thanks again...


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Getting rid of Prompts in a macro

Duncan, try Application.DisplayAlerts = False, this Want show display
alerts, turn it back on at the end of you code
something like this

Application.DisplayAlerts = False
'Your Code
Application.DisplayAlerts = True

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 97 & 2000
** remove news from my email address to reply by email **

"Duncan J" wrote in message
...
Hi Folks,
I've got a big macro, several tied into one. However, when running the

macro the prompts always come up one asks do you want to save, "YES" "NO"
which I'd like it automatically save with out the prompt. Then another on
comes on I don't want to save. Here's the code.
ActiveWorkbook.SaveAs Filename:="C:\otd\data\compile\International.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
ActiveWorkbook.Close
I suppose when closing the active workbook the prompt comes up asking me

to save and I don't want to save the second one. But also do not want the
prompt to show.
Thanks again...




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Getting rid of Prompts in a macro

Hi Duncan,

you just need a line:

ActiveWorkbook.SaveAs Filename:="C:\otd\data\compile\International.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False


ActiveWorkbook.Saved = true


ActiveWorkbook.Close



ActiveWorkbook.Saved = true

ActiveWorkbook.Close



do not use
application.displayalerts = false
unless you know what you're doing! Saved=true will do the job for you.

arno


  #4   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 234
Default Getting rid of Prompts in a macro

ActiveWorkbook.Close
ActiveWorkbook.Close


ActiveWorkbook.Close
ActiveWorkbook.Close False

Rob
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Getting rid of Prompts in a macro

Thanks Guys
I used arno's code. Now I only get the first pop up saying a file already exists in this location. DO you want to replace i
"yes" "No" The Other pop up is gone. tried robs and that did nothing. Used Pauls and of course no pop up's on that
anymore suggestions on the first pop up
ActiveWorkbook.SaveAs Filename:="C:\otd\data\compile\Domestic.xls", FileFormat:=
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False
, CreateBackup:=Fals
ActiveWorkbook.Saved = Tru
ActiveWorkbook.Clos
ActiveWorkbook.Saved = Tru
ActiveWorkbook.Clos



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Getting rid of Prompts in a macro

The Code would work if the file wasn't thier. However, I need it to
overwrite the file.

use
application.displayalerts = false/true immediately before/after the critical
line (only where you really need it). do not use it for the whole code as
you might miss some "real" error messages.

arno


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 macro which prompts for input and moves to a cell - repeated KenZimbo Excel Worksheet Functions 2 September 8th 08 02:02 PM
Macro within a macro and Macro Prompts comparini3000 Excel Discussion (Misc queries) 3 June 7th 06 01:28 PM
How to disable macro prompts for OK in Excel? Austin Excel Discussion (Misc queries) 8 May 10th 06 08:54 PM
Prompts sdmccabe Excel Discussion (Misc queries) 1 April 13th 06 06:03 PM
How can I suppress prompts during macro run? Andorv Excel Discussion (Misc queries) 2 October 19th 05 12:37 PM


All times are GMT +1. The time now is 07:31 AM.

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"