Stored Procedures executed from Excel - Can I capture the name of the Excel file?

  • I am using Stored Procedures executed from Excel via a pivot table to deliver reporting to end users. I have also set up a proc log table so I can track every time a report proc is executed, who is executing it, how many rows are returned, and how long the execute takes.

    Is there anyway, besides Excel VB, to capture the name of the Excel file and pass it back to SQL Server to store in my proc log table?

    I'm typically creating these reports and sending them to end users. Once I pass it off to an end user, they may take one of these pivot tables and put it into many different Excel files. It would help on my end if I knew the exact Excel file name that the proc was executed from.

  • To the best of my knowledge SQL Server isn't able to track an external/3rd party application that's calling the stored-procedure, however, it can track the credentials being used that executes the procedure. Since you're logging most everything via this proc log table anyway, I would recommend just adding another parameter to accept filename/path and use this in the VBA code to snag the tidbit of info you're looking for

    Application.ActiveWorkbook.FullName

    If need add a small code snippet to extract only the excel file and extension.

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply