Results 1 to 6 of 6

Thread: Using Visual C++ to automate Office

  1. #1
    Join Date
    Apr 2009
    Posts
    745

    Using Visual C++ to automate Office

    Hi friends,
    I have heard that we can automate an Office by using the Visual C++. I am not sure about it, so thought to ask you guys.!! Can we really use an automation to control Microsoft Office components from your Visual C++ applications. If its possible, then please explain me about the using Visual C++ to automate Office Hope that you understood my doubt.! Reply me as soon as possible. Also any other information about the topic would be grateful.

  2. #2
    Join Date
    Apr 2008
    Posts
    4,088

    Re: Using Visual C++ to automate Office

    Automation is a technology that lets you take advantage of an existing feature of the program and incorporate it into your own applications. For example, you can use the capabilities of the spelling checker and grammar in your Microsoft Word application without Microsoft Word visible to users. You can even use all the tools of data analysis, printing and graphics in Microsoft Excel. This technology can greatly simplify and accelerate your development. It is important to note that there are slight differences between the automation from C + + and C gross, because COM was designed around the class C + +.

  3. #3
    Join Date
    May 2008
    Posts
    3,316

    Re: Using Visual C++ to automate Office

    Automation is based on the COM component (Component Object Model). COM is a software architecture based on standard interfaces, and designed to separate code into self-contained objects. Think of it as an extension of the paradigm of object-oriented programming, but applicable to different applications. Each object exposes a set of interfaces, and any call to an object, such as initialization, notifications and data transfer happens through these interfaces. COM is also a set of services provided by dynamic link libraries (DLL Dynamic-Link Libraries) installed with the operating system. Automation uses many of its services.

  4. #4
    Join Date
    May 2008
    Posts
    353

    Re: Using Visual C++ to automate Office

    There are three main ways to use Automation: MFC, C # and import / C++ :
    1. With MFC, use Visual C + + ClassWizard to generate "wrapper classes" from the Type Library Microsoft Office. These classes, and other MFC classes, such as COleVariant, and COleSafeArray COleException, simplify the tasks of Automation. This method is generally preferred to others, and most of the examples of Microsoft Knowledge Base using MFC.
    2. # import, a new directive that became available with Visual C + + 5.0, creates "smart pointers" VC + + from a specified type library. It is very powerful, but rarely recommended because of problems with reference counting, which typically occur when used with Microsoft Office applications.
    3. Automation C / C + + is much more difficult but sometimes necessary to avoid overloading with MFC or problems with # import. You will work primarily with APIs such as CoCreateInstance (), and COM interfaces such as IDispatch and IUnknown.

  5. #5
    Join Date
    May 2008
    Posts
    390

    Re: Using Visual C++ to automate Office

    A type library is similar to a file header C / C + +. It contains the interfaces, methods and properties that a server publishes. You can view the type library with the Object Browser OLE / COM (Oleview.exe) provided with Visual C + +. You will find below the list of file names of type libraries for Microsoft Office 2003 and Microsoft Office 2007.
    • Office Word 2003 - MSWORD.OLB
    • Office Excel 2003 - excel.exe
    • Office PowerPoint 2003 - msppt.olb
    • Office Access 2003 - Msacc.olb
    • Office Outlook 2003 - msoutl.olb
    • Office Word 2007 - MSWORD.OLB
    • Office Excel 2007 - excel.exe
    • Office PowerPoint 2007 - msppt.olb
    • Office Access 2007 - Msacc.olb
    • Office Outlook 2007 - msoutl.olb

  6. #6
    Join Date
    Aug 2006
    Posts
    209

    Re: Using Visual C++ to automate Office

    To automate an object or an application embedded Office, you must obtain the IDispatch pointer of the object. It is available in the technical note Visual C + + No. 39 (TN039). You will find this technical note in the Library MFC (Microsoft Foundation Class) of the Reference Visual C + +. Type libraries provide information about objects, methods and properties you need. The best way to learn to navigate the object models Word, Excel and PowerPoint is to use the macro recorder in the Office applications.
    Blessings to you

Similar Threads

  1. Replies: 4
    Last Post: 13-09-2011, 08:23 PM
  2. How to Automate the bot in FrontierVille
    By Filiberto in forum Video Games
    Replies: 1
    Last Post: 10-02-2011, 04:26 AM
  3. How to automate the Winsetup from USB
    By @bLERINA@ in forum Operating Systems
    Replies: 4
    Last Post: 29-10-2010, 01:11 PM
  4. Replies: 5
    Last Post: 25-03-2010, 06:03 AM
  5. Visual Basic Error? in Microsoft Office 2003
    By CostasD in forum MS Office Support
    Replies: 5
    Last Post: 04-12-2008, 02:12 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,567,407.90367 seconds with 16 queries