Hi all,
I have inserted in a sheet a web connection.
to refresh that connection I use the following macro:
-------------
Sub Refresh_Connection_to_SF_Report()
Sheets("Sheet with connection to SF").Select
ActiveWorkbook.Connections("Connection to SF Report").Refresh
End Sub
-------------
it works beautifully but I need to login before I run this code.
Currently this is manual by doing the 3 steps below.
I would like a macro that emulates the following actions:
1. Right click into "Sheet with connection to SF", select "Edit Query"
2. enter username and password (taken from sheet "Credentials": user name in B1, Password in B2), click Login (NOT Import)
3. Click Import
there is no need for the user to see this process (it can happen on the background)
I just need to push the button and refresh the data connection circumventing the login issue:
if I am not logged in, log me in (execute the 3 steps) and refresh the data connection
if I am logged in, (ignore the 3 steps) just refresh the data connection
is this possible?
(FYI: using excel 2010, Google chrome as default browser, but as this will be used by other people, it would be cool for the macro to work with all browsers)
thank you very much in advance for your help.
Bookmarks