Join Walt Ritscher for an in-depth discussion in this video Understanding the .NET Office integration, part of Visual Studio 2010 Essential Training.
Microsoft Office is the world's dominant corporate application suite. A good portion of the business world uses Microsoft Excel, Outlook, and Word applications. Over the years, Microsoft has incorporated many extensibility features in Office applications. With Office, you can create add-ins, write macros and even access to core features of Office via Visual Basic for Applications, sometimes called VBA. The Visual Studio team is also part of this integration toolset. In version 2003, they published a special copy of Visual Studio, called Visual Studio Tools for Office.
In Visual Studio 2010, Office integration is built right in. Let me show you some of the types of applications you can build with Visual Studio. I am using my File > New menu, and I am clicking New > Project. I have to choose a language. I can choose either Visual Basic or C#. The underlying programming model for inside Office applications is Visual Basic for Applications. Up until this release of Visual Studio, programming Office applications in C# has been a frustrating experience. The object model in VBA doesn't mesh very well with the C# mechanics.
Now that C$ 4.0 is out, it's much easier to write Office automation applications. For my demos, I'm going to use Visual Basic. So I am going to open up the Visual Basic node and choose Office and then filter it down to only the Office 2010 applications. As you can see, nearly every Office product is represented in here. Some of the Office products have multiple items. For instance, Excel has an add-in, a template, and a workbook. Let's talk about the difference between a workbook and an add-in.
A workbook, when you create an Excel workbook, all of the code that you're going to write is embedded in that one document. If you open that document, you can use the code. If you open any other documents, that code is not available. When you create an add-in, you're creating an application that is independent of any document. Most of the Office applications I've seen have a separate add-in manager, and this allows the user to remove an add-in when it's no longer needed. As you can see, there is an add-in for Excel and one for Outlook, and so on.
Let me just demonstrate what you can do with an Excel Workbook. I am going to click here and then click on OK. Visual Studio asks me if I'd like to create a new document or use an existing document. I am going to use a new document. As you can see, in the designer area of Visual Studio is a copy of Excel. Anything that you can do in Excel you can do inside Visual Studio. I can add text to a cell. I can take that cell and format it. I can apply Bold text.
If I have numbers I can put the numbers in here and then add a auto-sum formula. If I choose to run the application, I can press F5 and debug the application. Here I am pressing F5. Excel is going to launch. And the important thing is I'm now debugging my code that's inside my Excel code behind. Let me show you that code behind. I am going to close Excel and then switch over to this Sheet1.vb. And then I am going to right-click on it and choose View Code.
And as you can see, it's just Visual Basic code with some event procedures here that run when the sheet starts up and other one that runs when the sheet shuts down. I can also work with Word and the other Office products. Let me show you an example of that. I am going to choose New > Project, discard my existing one, scroll down, and pick Word Add-in. Remember, add-ins are independent of any document. Now, of course, I don't have a designer because it's not part of a document.
This is typically added to the Add-in menu in your application. So if I were to run this and go look in the Add-in menu inside Word, I would see by custom add-in. I'll show you an example of that in a later movie. As you see, this movie is just a quick overview of what you can do with Office in Visual Studio. The rest of the movies in this chapter dig into each topic in more detail.
- Creating a Visual Studio project
- Building the user interface
- Binding to an RSS feed
- Coding with IntelliSense
- Creating rich Internet applications with Silverlight
- Building Windows applications with Windows Forms
- Integrating with SQL Server
- Working with Microsoft Office applications
- Understanding extensibility in Visual Studio
- Working with data, ADO.NET and datasets
- Using source control
Skill Level Intermediate
Q: Which edition of Visual Studio 2010 do I need to follow along in this course?
A: The course is taught with Visual Studio 2010 Professional, but can also be used with the Premium or Ultimate editions. The Express editions of Visual Studio, including Visual Basic 2010 Express, Visual C# 2010 Express, and Visual C++ Express, are not covered in this course.
Q: I'm attempting to download the exercise files for this course, and my virus protection is blocking me from unzipping the downloaded file. Are the files corrupted?
A: The alert is a false-positive message. Your antivirus software is detecting the active code included in the exercise files, which in some ways resembles viral code. There is nothing to be alarmed about and you can ignore the warning. This is common among coding courses and environments.
Silverlight 3 Essential Trainingwith Walt Ritscher6h 50m Beginner
1. Getting Started
2. Exploring the Visual Studio Workspace (IDE)
3. Building a Simple Application
4. Exploring the Code Editors
5. Working with Code
6. Understanding the Project Types
7. Digging Into Your Data
8. Debugging Your Application
9. Testing Your Application
10. Deploying Your Application
11. Working with Source Control
12. Integrating with Microsoft Office Applications
Making an Excel 2010 add-in5m 21s
13. Extending Visual Studio
14. Configuring Your Application
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.