remove msg box prompt

J

Junior728

Hi,

I am running a macro but it is not running smoothly due to many msg prompt
boxes appearing to ask to click "Yes","No" etc and there is also another msg
box that prompted me that there is a large amt of data from clipboard to be
copied over, and also another msg box that ask me to replace existing file,
"yes" or "no prompt.

How can i script it so that they will not appear?
 
P

paul.robinson

Hi,

I am running a macro but it is not running smoothly due to many msg prompt
boxes appearing to ask to click "Yes","No" etc and there is also another msg
box that prompted me that there is a large amt of data from clipboard to be
copied over, and also another msg box that ask me to replace existing file,
"yes" or "no prompt.

How can i script it so that they will not appear?

Hi
Put in
Application.Displayalerts = False
'your code
Application.Displayalerts = True

regards
Paul
 
M

Mike

Try this:-

Application.DisplayAlerts = False

Don't forget to set it back to TRUE at the end of your macro.

Mike
 
J

Junior728

Hi,

it doesnt work. The msg prompt still comes up as before. Is there other
methods of deactivating it? OR Did i put in correctly as in my e,g???,:

Sub ScrapInfo()
'Criteria: Need to fill up Col M with WH info first.

Application.ScreenUpdating = False
Application.DisplayAlerts = False 'HOW TO OFF ALL DIALOG BOXES?


Dim LastRow As Long

f$ = InputBox("Pls type FileName", "Input FileName to Open")
g$ = InputBox("Pls type SheetName", "Input SheetName to Open,
RES,CAP,OTHERS?"
..........................................................................centre of code

Application.CutCopyMode = False
Columns("C:C").Select
Range("C14").Activate
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

ActiveWorkbook.SaveAs Filename:= _
"H:\My WorkStation\scraplist.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False

ActiveWorkbook.Close

Application.DisplayAlerts = False

End Sub
 
P

papou

Hello
Which message is still popping up during your code?
Please note:
Application.CutCopyMode = False
should be placed immediately after the paste operation in your code ie:

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

Application.CutCopyMode = False

In addition I would suggest the line
Application.DisplayAlerts = False
to be placed immecdiately before
ActiveWorkbook.SaveAs Filename:= _
"H:\My WorkStation\scraplist.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False


HTH
Cordially
Pascal
 
J

Junior728

Hi Papou,

These are the 3 msgbox encountered: in my macro

1.save large data on clipboard?
2.save over existing file?
3.Msgbox to inform that a certain file is moved to folder

Do i need to have diff ways for closing each one of them? or is there a
general code to close all msg prompted like this.
 
P

papou

Hello
Provided the lines Application.DisplayAlerts = False and
Application.CutCopyMode = False are positioned correctly in your code as I
mentioned in my previous reply, I would say no, there should be no need for
further specific instructions.
But may be someone will provide you with further advice.

HTH
Cordially
Pascal
 
P

paul.robinson

Hi
These look like message boxes created by you, not Excel itself, so I
don't think the displayalerts will work on them. The buttons on these
forms call macros, so simply call the macros directly

MacroName parameterlist

where parameterlist is the list of paremeters for the macro to work on
(if any). Delete the message box code and replace with the MacroName
code as above.

regards
Paul
 

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