• Blog
  • Info Support
  • Career
  • Training
  • International Group
  • Info Support
  • Blog
  • Career
  • Training
  • International Group
  • Search
logo InfoSupport
  • Latest blogs
  • Popular blogs
  • Experts
      • Alles
      • Bloggers
      • Speakers
  • Meet us
  • About us
    • nl
    • en
    • .NET
    • Advanced Analytics
    • Agile
    • Akka
    • Alexa
    • Algorithms
    • Api's
    • Architectuur
    • Artificial Intelligence
    • ATDD
    • Augmented Reality
    • AWS
    • Azure
    • Big Data
    • Blockchain
    • Business Intelligence
    • Cloud
    • Code Combat
    • Cognitive Services
    • Communicatie
    • Containers
    • Continuous Delivery
    • CQRS
    • Cyber Security
    • Dapr
    • Data
    • Data & Analystics
    • Data Science
    • Data Warehousing
    • Databricks
    • DevOps
    • Digital Days
    • Docker
    • eHealth
    • Enterprise Architecture
    • Hacking
    • Infrastructure & Hosting
    • Innovatie
    • Integration
    • Internet of Things
    • Java
    • Machine Learning
    • Microservices
    • Microsoft
    • Microsoft Bot Framework
    • Microsoft Data Platform
    • Mobile Development
    • Mutation Testing
    • Open source
    • Pepper
    • Power BI
    • Privacy & Ethiek
    • Python
    • Quality Assistance & Test
    • Quality Assurance & Test
    • Requirements Management
    • Scala
    • Scratch
    • Security
    • SharePoint
    • Software Architecture
    • Software development
    • Software Factory
    • SQL Server
    • SSL
    • Start-up
    • Startup thinking
    • Stryker
    • Test Quality
    • Testing
    • TLS
    • TypeScript
    • Various
    • Web Development
    • Web-scale IT
    • Xamarin
    • Alles
    • Bloggers
    • Speakers
Home » Synchronize TFS and Excel via VBA
  • Synchronize TFS and Excel via VBA

    • By Richard Zaat
    • Requirements Management 11 years ago
    • Requirements Management 0 comments
    • Requirements Management Requirements Management
    Synchronize TFS and Excel via VBA

    Instead of running reports in TFS and exporting them to Excel, it is possible to run the TFS queries from Excel and get the results into Excel directly. This can even be automated using VBA.

    Here I’ll explain the steps to take how to set up your environment so you can synchronize your TFS with Excel, and keep it synchronized, using VBA.

    Steps to take:

    Preparation

    1. Of course, make sure you have rights to access TFS
    2. Install Team Explorer on your PC. This will install the “Team” Add In in your local Office version. You’ll need this TFS Add-in to connect to TFS. (more info: http://msdn.microsoft.com/en-us/library/ms181661%28VS.90%29.aspx )
    3. Create a query in TFS that will return all the data you want. There are more locations to create the query, but I would strongly suggest to keep them all stored in the same place, TFS.

    Get the results of your TFS query in Excel

    1. Run Excel
    2. Open up a clean and brand new worksheet (or tab, whatever you want to call it)
    3. Go to the “Team” tab in your ribbon (it should be there, otherwise try installing the “Team Explorer”) and select “New list“
    4. Connect to your TFS server, and select your TFS query
    5. Your list should now appear within Excel

    Refresh / synchronize TFS (work items) into Excel using VBA

    1. Create the two VBA functions in Excel (taken from and more info about TFS / Excel: http://blogs.msdn.com/b/team_foundation/archive/2010/11/06/programming-for-the-tfs-excel-add-in.aspx ). shtTFSExcel_Name is the name of the worksheet in Excel that contains your TFS query results.
    2. You’re done. Run the RefreshTeamQuery to update your TFS list.

     

    Private Function FindTeamControl(tagName As String) As CommandBarControl
    Dim commandBar As commandBar
    Dim teamCommandBar As commandBar
    Dim control As CommandBarControl

        For Each commandBar In Application.CommandBars
    If commandBar.Name = “Team” Then
    Set teamCommandBar = commandBar
    Exit For
    End If
    Next

    If Not teamCommandBar Is Nothing Then
    For Each control In teamCommandBar.Controls
    If InStr(1, control.Tag, tagName) Then
    Set FindTeamControl = control
    Exit Function
    End If
    Next
    End If

    End Function

    Sub RefreshTeamQuery(shtTFSExcel_Name As String) ‘(rangeName As String)

    Dim activeSheet As Worksheet
    Dim teamQueryRange As Range
    Dim refreshControl As CommandBarControl

    Set refreshControl = FindTeamControl(“IDC_REFRESH”)

    If refreshControl Is Nothing Then
    MsgBox “Could not find Team Foundation commands in Ribbon. Please make sure that the Team Foundation Excel plugin is installed.”, vbCritical
    Exit Sub
    End If

    ‘ Disable screen updating temporarily so that the user doesn’t see us selecting a range
    Application.ScreenUpdating = False

    ‘ Capture the currently active sheet, we will need it later

    Set activeSheet = ActiveWorkbook.activeSheet
    Set teamQueryRange = Worksheets(shtTFSExcel_Name).ListObjects(1).Range

    teamQueryRange.Worksheet.Select
    teamQueryRange.Select
    refreshControl.Execute

    activeSheet.Select

    Application.ScreenUpdating = True
    End Sub

     

    Share this

Richard Zaat

View profile

Related IT training

Go to training website

Related Consultancy solutions

Go to infosupport.com

Related blogs

  • Mijn ontwikkelpad

    Mijn ontwikkelpad Stephan Versteegh - 1 year ago

  • Verantwoordelijkheid pakken in jouw eigen persoonlijke …

    Verantwoordelijkheid pakken in jouw eigen persoonlijke … Stephan Versteegh - 1 year ago

  • How to improve your non-functional requirements

    How to improve your non-functional requirements Info Support - 5 years ago

Related downloads

  • Beslisboom voor een rechtmatig ‘kopietje productie’

  • Klantreferentie: Remmicom zet wetgeving om in intellige…

  • Klantreferentie RDW: Samenwerken voor veilig en vertrou…

  • Klantreferentie BeFrank: Strategische IT voor een innov…

  • Wie durft te experimenteren met data in de zorg?

Related videos

  • mijnverzekeringenopeenrij.nl

    mijnverzekeringenopeenrij.nl

  • Winnaar | Innovation Projects 2017

    Winnaar | Innovation Projects 2017

  • Explore | Info Support & HAN & Poliskluis

    Explore | Info Support & HAN & Poliskluis

  • LifeApps bij HagaZiekenhuis

    LifeApps bij HagaZiekenhuis

  • Info Support | Bedrijfsfilm

    Info Support | Bedrijfsfilm

Nieuwsbrief

* verplichte velden

Contact

  • Head office NL
  • Kruisboog 42
  • 3905 TG Veenendaal
  • T +31 318 552020
  • Call
  • Mail
  • Directions
  • Head office BE
  • Generaal De Wittelaan 17
  • bus 30 2800 Mechelen
  • T +32 15 286370
  • Call
  • Mail
  • Directions

Follow us

  • Twitter
  • Facebook
  • Linkedin
  • Youtube

Newsletter

Sign in

Extra

  • Media Library
  • Disclaimer
  • Algemene voorwaarden
  • ISHBS Webmail
  • Extranet
Beheer cookie toestemming
Deze website maakt gebruik van Functionele en Analytische cookies voor website optimalisatie en statistieken.
Functioneel
Altijd actief
De technische opslag of toegang is strikt noodzakelijk voor het legitieme doel het gebruik mogelijk te maken van een specifieke dienst waarom de abonnee of gebruiker uitdrukkelijk heeft gevraagd, of met als enig doel de uitvoering van de transmissie van een communicatie over een elektronisch communicatienetwerk.
Voorkeuren
De technische opslag of toegang is noodzakelijk voor het legitieme doel voorkeuren op te slaan die niet door de abonnee of gebruiker zijn aangevraagd.
Statistieken
De technische opslag of toegang die uitsluitend voor statistische doeleinden wordt gebruikt. De technische opslag of toegang die uitsluitend wordt gebruikt voor anonieme statistische doeleinden. Zonder dagvaarding, vrijwillige naleving door uw Internet Service Provider, of aanvullende gegevens van een derde partij, kan informatie die alleen voor dit doel wordt opgeslagen of opgehaald gewoonlijk niet worden gebruikt om je te identificeren.
Marketing
De technische opslag of toegang is nodig om gebruikersprofielen op te stellen voor het verzenden van reclame, of om de gebruiker op een website of over verschillende websites te volgen voor soortgelijke marketingdoeleinden.
Beheer opties Beheer diensten Beheer leveranciers Lees meer over deze doeleinden
Voorkeuren
{title} {title} {title}