Archive for October, 2013

TFS in Excel: Exporting Charts Using VBA

Problem You want to automate the exporting of a chart within an Excel worksheet to a PNG image file using a VBA macro. Solution Private Sub ExportChartToFile(Worksheet as String, ChartNumber As Integer, Filename As String) Dim objChrt As ChartObject Dim myChart As Chart Dim FilePath As String Set objChrt = Sheets(“Worksheet”).ChartObjects(n) Set myChart = objChrt.Chart […]

TFS in Excel: Refreshing a TFS Query Using VBA Macro in Excel

Problem You have a Team Foundation Server connected worksheet in Excel 2010, and want to automate the clicking of the Refresh button on the Team ribbon. Solution Add these two procedures to your VBA macro: Private Sub RefreshTeamQueryOnWorksheet(worksheetName As String) Dim activeSheet As Worksheet Dim teamQueryRange As Range Dim refreshControl As CommandBarControl Set refreshControl = […]