Hello,

I am working on a worksheet that pulls data from SQL Server. I want it to do this via "Private Sub Workbook_Open()". I am currently pulling data using "DATA--->FROM OTHER SOURCES--->SQL SERVER". I tried to record the macro but it didn't work out too well.

On the connection properties, I use windows authentication and use SQL as the command type. I run "SELECT * FROM TABLE" in this command to pull data into the cells in excel.

Everytime I open the document it will run the query to get the new data which is what I want. The reason I want it in a "Private Sub Workbook_Open()" is so that I can execute another macro after the data is extracted. Currently, the method I am using will run the macro the same time I am pulling data.

I searched online and was unable to pull anything that I actually understand, so I come here for guidance. I posted a topic similar to this before but no one responded. Can someone help or point me in the right direction?