How not to display any pop up message for macro?

E

Eric

When macro imports an external links into sheets, it pops up a message is
about the pasting area is larger then worksheet for confirmation, does anyone
have any suggestions on how not to display any pop up message for running
macro?

Thanks in advance for any suggestions

qryConnect = "URL;http://www.mmacycles.com"
Set anySheet = Sheets("MMA")
With anySheet.QueryTables.Add(Connection:=qryConnect, Destination _
:=anySheet.Range("$A$1"))

.Name = "o070104"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = True
.BackgroundQuery = True
.RefreshStyle = xlInsertEntireRows
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
 
P

Per Jessen

Maybe this:

Application.DisplayAlerts=False

Just remember to set to True again.

Regards,
Per
 
E

Eric

Thank you very much for suggestions
Do I need to set it to True at the end of macro?
What if I don't set it to True, if I run another macro, will the default
setting be false?
Thank you very much for any suggestions
Eric
 
P

Per Jessen

When the macro stop DisplayAlerts is reset to true, but I would always
reset it to true as soon as possible in my macro, as other unexpected
alerts will be supressed until it is set to True.
 
F

FSt1

hi
if you don't set it to true again then all display messages, alerts,
warnings ect will not be display whether you are running a macro or not. it
is not wise to turn off alerts and NOT turn them back on. for the duration
of a singel macro, it may be permissible but never let a macro stop without
turning alerts back on. otherwise, excel will be severly crippled.

regards
FSt1
 

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