views:

230

answers:

0

Hi all,

I've struggling to find a way to get and change and excel 2007 workbook connection (Menu Data -> Existing Connections -> Connections on this Workbook).It's a connection (several actually) to a SQL Server and used in a pivot table.

I've tried using Application.ActiveWorkbook.Connections or Globals.ThisWorkbook.Connections but they both return always Null..I've tried in an sheet event as well as in a custom ribbon's button event as well.

The only way left I can think of is use to code a VBA method that does the work and then invoque it in my VSTO code, but it's not very elegant is it...

Thanks in advanced :-)