简体   繁体   中英

How to open a file using Excel VBA and turn off updating links

I currently have a macro where I open up another file, copy data, and paste the data in my file with macro. The feeder file where I copy the data has links to other other workbooks. How would I have the macro continue without prompting me to update links.

Sub FeedFiles()

Application.DisplayAlerts = False
Application.ScreenUpdating = False

Workbooks.Open Filename:= _
    "T:\Planning\FY Budget\2018 Budget\Director Templates\With updates\2018 Budget PL_HC_CAP - Thomson_V2.xlsx" _
, Password:="Thomson18"
Workbooks("2018 Budget PL_HC_CAP -Thomson_V2.xlsx").Worksheets("Summary").Range("A1:AH227").Activate
Workbooks("2018 Budget PL_HC_CAP - Thomson_V2.xlsx").Worksheets("Summary").Range("A1:AH227").Copy
Workbooks("2018 Budget PL_HC_CAP - Total 802.xlsm").Worksheets("Thomson").Range("A1:AH227").PasteSpecial xlPasteValues
Workbooks("2018 Budget PL_HC_CAP - Thomson_V2.xlsx").Close

 Application.DisplayAlerts = True
 Application.ScreenUpdating = True
 End Sub

In A Short: Workbooks.Open method has several parameters. One of them is UpdateLinks which you have to set to false .

Dim wbk As Workbook
Set wbk = Application.Workbooks.Open(FileName:="FullePathToExcelFile", UpdateLinks:=False)

Try! Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM