I already have vba that modifies queries on existing data sources. But for adding new data sources (what I would call a new DB connection), I am stumped. When I try to record a macro that adds a new data source, the macro is created but there is no code generated - just an empty sub routine.
The steps I am trying to simulate are:
- Click Data
- Get Data From Database
[In my case, I choose Oracle, but I suppose all options are working with the same underlying VBA class of object?]
From there, you enter the server. In my case, what works is
HostName:Port/OracleUniverse
If the server is new to the machine, then it prompts you for credentials. Otherwise, it uses cached credentials.
I've attached a picture indicating where the new data source needs to appear:
Note: I would happily switch to a traditional Windows ODBC User DSN but Oracle drivers are not available on my machine (I work for government and cannot add them).