Hi, I have code that will query an external data source using my username and password in VBA (username and password are supplied through a userform. This way, I will not see the Excel dialog box pop up for my username and password. This code works just fine (User, Password, and SQL are variables...self explanatory what each is):
Now, where I'm running into trouble is when I want to return results in a pivot table rather than rows on a sheet. For the next piece of code to work, I have a pivot table already created on sheet3 that was originally setup to query an external source (editing a normal pivot table not setup with the external source doesn't work). I edit the connection and commandtext, but as soon as I run the commandtext line, Excel's username/password dialog box will pop up, but I have already provide that information in the connection. Can anyone help me be able to suppress the Excel dialog box and use the username and password that I supplied???
Bookmarks