Hi, I have the following VBA code:
Set Wbk1 = ActiveWorkbook
Fname = "Path name"
Set Wbk2 = Workbooks.Open(Fname)
Wbk2.RefreshAll
DoEvents
Wbk2.Sheets(1).Copy , Wbk1.Sheets(Wbk1.Sheets.Count)
Wbk2.Close False
So basically this code is part of a macro that opens ANOTHER workbook which contains a macro and has power query that refreshes the tables to update the latest information. Then I copy the sheet from the second workbook into the first workbook. The issue is after the 'Wkbk2.RefreshAll' executes, it doesn't refresh with the latest information. However, when I run this part of the macro line by line it refreshes. What could be the problem?
Thanks
Set Wbk1 = ActiveWorkbook
Fname = "Path name"
Set Wbk2 = Workbooks.Open(Fname)
Wbk2.RefreshAll
DoEvents
Wbk2.Sheets(1).Copy , Wbk1.Sheets(Wbk1.Sheets.Count)
Wbk2.Close False
So basically this code is part of a macro that opens ANOTHER workbook which contains a macro and has power query that refreshes the tables to update the latest information. Then I copy the sheet from the second workbook into the first workbook. The issue is after the 'Wkbk2.RefreshAll' executes, it doesn't refresh with the latest information. However, when I run this part of the macro line by line it refreshes. What could be the problem?
Thanks