update links in open file method

baha17

Board Regular
Joined
May 12, 2010
Messages
181
Good Day,

I wanted to write a code for the user to open a file in specific destinations and choose excel file among them. then do all necessary copy and paste things. I found a code here and altered a bit for my use. It works fine. But my problem is it kept on displaying update links message. I tried to avoid by using
Code:
UpdateLinks:=0
but could not manage.
Anyone would like to give me a hand?

Thank you very much
Cheers Baha

Code:
Sub OpenFileCopyRange()
Application.DisplayAlerts = False
Application.ScreenUpdating = False


ChDrive "G:"
ChDir "G:\Sales\EOD Reports\Top 20 Daily\"
Set sh = ThisWorkbook.Sheets("T20 SCL")
Set sh2 = ThisWorkbook.Sheets("Sds T20")
Set sh3 = ThisWorkbook.Sheets("Vn T20")
Set sh4 = ThisWorkbook.Sheets("Pla T20")
Set sh5 = ThisWorkbook.Sheets("SC T20")
Set sh6 = ThisWorkbook.Sheets("Par T20")


Filename = Application.GetOpenFilename("Excel files (*.xls*), *.xls*", UpdateLinks:=0, Title:="Please select a file that you would export the report from")
If Filename <> False Then
  Workbooks.Open (Filename)
  Sheets("Top 20").UsedRange.Copy sh.Range("A1:V74")
  Sheets("Snd").UsedRange.Copy sh2.Range("A1:V74")
  Sheets("Ven").UsedRange.Copy sh3.Range("A1:V74")
  Sheets("Plaz").UsedRange.Copy sh4.Range("A1:V74")
  Sheets("SC").UsedRange.Copy sh5.Range("A1:V74")
  Sheets("Par").UsedRange.Copy sh6.Range("A1:V74")
  ActiveWorkbook.Close
Else
 Exit Sub
End If






Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
 
Last edited:

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,216,729
Messages
6,132,383
Members
449,724
Latest member
Ahmedali999

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