Disable alerts

L

Legacy 51064

Guest
I am trying to copy some data from workbook1 to workbook2, but I am getting an Alert. The data in workbook1 is linked to other workbooks and the alert is asking me if I want to update workbook2. I do not want to update the information. How do I get rid of that alert?

Thank you

Sub Macro2()

'Deactivates the alerts and screen updates
Application.DisplayAlerts = False

'Creates the Comm reversal
InvoiceID = Sheets("Commissions").Range("L6").Value
Workbooks.Open Filename:= _
"C:\My Documents\Work\Journal Entries\" & InvoiceID

Sheets("JE").Range("A13:F" & Cells(Rows.Count, "O").End(xlUp).Row).Copy
Workbooks("workbook2.xls").Sheets("Commissions").Range("A13").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False


ActiveWindow.Close

End Sub
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Change this
Workbooks.Open Filename:= _
"C:\My Documents\Work\Journal Entries\" & InvoiceID
to
application.displayalerts = false
Workbooks.Open Filename:= _
"C:\My Documents\Work\Journal Entries\" & InvoiceID
Application.displayalerts = true

HTH
Cal
 
Upvote 0
Check out the Update Links portion of the Open Method:

UpdateLinks Optional Variant. Specifies the way links in the file are updated. If this argument is omitted, the user is prompted to specify how links will be updated. Otherwise, this argument is one of the values listed in the following table.

Value Meaning
0 Doesn't update any references
1 Updates external references but not remote references
2 Updates remote references but not external references
3 Updates both remote and external references

HTH,

Smitty
 
Upvote 0
Thanks, that make a lot of sense now.

Workbooks.Open Filename:= _
"C:\My Documents\Work\Journal Entries\" & InvoiceID, UpdateLinks:=0
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,332
Members
449,077
Latest member
jmsotelo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top