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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Cbrine

Well-known Member
Joined
Dec 2, 2003
Messages
3,196
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
 

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
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
 
L

Legacy 51064

Guest
Thanks, that make a lot of sense now.

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

Forum statistics

Threads
1,137,366
Messages
5,681,068
Members
419,950
Latest member
BeckiJae

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
Top