fbelisario
New Member
- Joined
- Jul 8, 2020
- Messages
- 1
- Office Version
- 365
- 2016
- Platform
- 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:
I was wondering if anyone has stumbled across something like that.
Thank you.
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.