Microsoft Office Automation 2010

Best article 15-03-2010 - 15-04-2010  August 29, 2013 – 00:25
Review: Microsoft Office Professional 2010 is comprehensive but

Congratulations to Mr. Martin Pascal ! His article was vote the best among the contributions MSDN 15-03-2010 - 15-04-2010

How to Use Automation with Excel and VB.NET?

Preparations

To control Excel, you must add to your project a reference to Microsoft Excel Object Library (in COM components) or directly reference the Primary Interop Assemblies (PIA) Microsoft.Office.Interop.Excel.dll, Microsoft.VBE.Interop . dll and Office.dll

In this example I will use the second solution.

About Primary Interop Assemblies

Although Microsoft recommends using a version of the PIA corresponding to the Office installed together with your application version, I found that there is a good backward compatibility between these assemblies. So I made it a habit to use an old version of the PIA, those of Office XP. They have the advantage of allowing my application to run on all versions of Office XP to 2007.

You can download these assemblies on the Microsoft website:

The basics of Excel automation

Creation and assignment of the Excel object

XlApp As Microsoft.Office.Interop.Excel.Application = New Microsoft.Office.Interop.Excel.Application() Dim xlApp As New Microsoft.Office.Interop.Excel.Application Microsoft.Office.Interop.Excel.Application = ()

Creating a Workbook

XLDestBook As Microsoft.Office.Interop.Excel.WorkbookXLDestBook = XlApp.Workbooks.Add Sun XLDestBook As Microsoft.Office.Interop.Excel.WorkbookXLDestBook = XlApp.Workbooks.Add

Open an existing workbook

) XLDestBook XlApp.Workbooks.Open = ("c: \ monfichier.xls")

Adding a sheet

xlSheet As Microsoft.Office.Interop.Excel.WorksheetxlSheet = XLDestBook.Worksheets.Add Sun xlSheet As Microsoft.Office.Interop.Excel.WorksheetxlSheet = XLDestBook.Worksheets.Add

Add text in a cell

xlSheet.Cells (1, 2). value = "Test writing in cell B1"

Add a formula in a cell

xlSheet.Cells (1, 3). formula = "1 = 5"

The forms must be written in the language of Excel. If your users are likely to use Excel versions in different languages ​​so you should bring your formulas. For this you can use this reference

Recommendations

Make it a habit before processing automation disable the Excel screen refresh, and prevent user input. The performance will be greatly improved, and this will prevent your users from disrupting the treatment.

For this, use the following lines before any treatment:

XlApp.ScreenUpdating = FalseXlApp.Interactive = False

Iron these parameters to True when your treatment is completed, otherwise Excel will be unusable.

For more information please refer to the Microsoft Knowledge Base:

Attention to language

If you have users using an English version of Windows, there are chances that your application crashes with message: Error: 0x80028018 (-2147647512) - Description: Old Format or Invalid Type Library

This scenario occurs when the user has customized the Windows regional settings. This is a case that I regularly met with expatriates. They select the locale in their country of residence, and change the decimal separator and the currency to match those of their country of origin.

Source: social.msdn.microsoft.com

You might also like:

WinWorkers Automation.wmv
WinWorkers Automation.wmv
Microsoft Dynamics GP 2013 Web Client Installation
Microsoft Dynamics GP 2013 Web Client Installation
Microsoft Dynamics GP: Data integrity
Microsoft Dynamics GP: Data integrity

Future of VBA

I've learned a bit of VBA for Excel and have had some pretty good results with it at work - saving time, automating some things, and one general macro I created that briefly made me the office hero. I'd like to learn more about it but I read that Microsoft is trying to kill VBA. When do you think it will be phased out? Not sure if it makes sense to learn more about something that is going away. Anyone know?

A novice's guide to backing up a PC  — ITProPortal
There's also an Outlook 2007/2003/2002 add-in from Microsoft called Personal Folders Backup that does just what it says. Follow these instructions from ..

How to send personalized emails to multiple people in one click
How to send personalized emails to multiple people in one click
South-Western Keyboarding and Word Processing Essentials, Lessons 1-55: Microsoft® Word 2010 (College Keyboarding)
eBooks (South-Western)

Related posts:

  1. Microsoft Office Automation Security
  2. Microsoft Office Automation Support
  3. Microsoft Office Automation using c
  4. Microsoft Office Automation tools
  5. Microsoft Office Automation Word

  • Avatar Australia How is Microsoft word different from Open Office Word Document?
    Jan 06, 2010 by Australia | Posted in Other - Computers

    Open Office Word Document is free. Microsoft isn t. Micrsosoft is around $100 for my computer. What s the difference?

    • OpenOffice is free, but the downside is that it needs Java to run on. Java takes up about 300MB of hard drive space and must also be running on your system. This takes up more memory resources, making your system run slower, including OpenOffice itself. You should also check out SSuite Office for a free office suite. Their software also don t need to run on Java or .NET, like so many open source office suites, so it makes their software very …

  • Avatar d4rkph30n1x Which is better, (and why), open office, or the newest Microsoft Office?
    Feb 03, 2010 by d4rkph30n1x | Posted in Software

    Deciding which to get, would rather get open office, but would need to know if it can open all of the files of Microsoft office, mainly Word, because have old version of word at home, so need updating, but have newest Microsoft word at work, so need it to be compatible with each other, any help much valued, thanks. :)

    • It is compatible.Did you even try to search about this? Read here Even big cities have left Microsoft for Open Office and of course that means that it is OK Why? It is free of charge and can do the same things.

  • Avatar Carl 1) Two information systems that support the entire organization are A. enterprise resource planning systems an?
    Jun 24, 2012 by Carl | Posted in Small Business

    1) Two information systems that support the entire organization are A. enterprise resource planning systems and dashboards B. transaction processing systems and office automation systems C. enterprise resource planning systems and transaction processing systems D. expert systems and office automation systems 2) is the direct use of information systems by employees in their work A. Transaction processing systems B. End-user computing C. Decision …

    • Copy and paste this link to get the answers for BIS/220 Final Exam: