Refresh a web connection with CSV file - (Office 2016)

fbelisario

New Member
Joined
Jul 8, 2020
Messages
1
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello,
I'm developing a project where I must update a web connection (CSV file) and return some of the updated data. For updating the connection I use RefreshAll function.

In the first tests, using Office 365, it worked perfectly. However, when the tests using Office 2016 started, there was a problem I couldn't solve yet: after running the RefreshAll function, Excel activates the sheet where the connection was created and selects the range with the connection data. After that, I can't go back to the main sheet using code (it only returns to the main sheet when I click the sheet using the mouse.

The same thing happens if I refresh the connection mannually (without VBA code).

The connection property "Enable background refresh" is unchecked.

Please check the code below:

VBA Code:
Sub AtualizaConexao()
    With ThisWorkbook
        .RefreshAll
        DoEvents
        .Sheets("Principal").Activate
        .Sheets("Principal").Range("A1").Select
        MsgBox "Concluído"
    End With
End Sub

I was wondering if anyone has stumbled across something like that.

Thank you.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
You cannot do that in XL2016 because Microsoft doesn't update Power Query to new version.
You need to buy new version of Office (365 or 2019) if you want use this option and some more
(it's all about money all the time)
 
Upvote 0

Forum statistics

Threads
1,215,062
Messages
6,122,925
Members
449,094
Latest member
teemeren

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