Office integration

masterx81

New member
Joined
Mar 10, 2005
Messages
3
Hi, This is my first post on this forum :-p
I develop using VB.net...
I need an advice on how to use the office integration...
My next application need to go over multiple machines, with different software/hardware installed. The application need to open a word document, add some lines, print, ecc...
The problem is that i need to integrate it with multiple versions of office (97,XP,2003... all!!!)...
Is possible? There is a method?
Very thanks :P
 
Yep, its possible...first use a reference to the Office 97 dll. Ive only used Words spell check so Im going to post an example of using Excel, knowing that they are very similar...and some web searching will probably get you the rest.
Code:
        Dim excelApp As New Excel.Application()
        If excelApp Is Nothing Then
            Dim frmInformationBox As New InformationBox()
            frmInformationBox.Captions("Excel Installation Error", "Microsoft Excel must be installed on this computer for this feature to operate.", "Information", "Okay")
            frmInformationBox.ShowDialog()
            If frmInformationBox.Response = DialogResult.OK Then
                Exit Sub
            End If
        End If

        Dim frmExcelExport As New ExcelExport()
        frmExcelExport.Show()
        Cursor.Current = Cursors.AppStarting
        Application.DoEvents()

        Dim excelBook As Excel.Workbook = excelApp.Workbooks.Add
        Dim excelWorksheet As Excel.Worksheet = CType(excelBook.Worksheets(1), Excel.Worksheet)

from there you just build on your application.
 
First of all, thanks for the answer ;)

So, if include and use the "Microsoft Word 8.0 Object Library" in the project, when i deploy the software where is installed, for example, Word 2003, it still work? Now I try...
Thanks for the attention!


DiverDan said:
Yep, its possible...first use a reference to the Office 97 dll. Ive only used Words spell check so Im going to post an example of using Excel, knowing that they are very similar...and some web searching will probably get you the rest.
Code:
        Dim excelApp As New Excel.Application()
        If excelApp Is Nothing Then
            Dim frmInformationBox As New InformationBox()
            frmInformationBox.Captions("Excel Installation Error", "Microsoft Excel must be installed on this computer for this feature to operate.", "Information", "Okay")
            frmInformationBox.ShowDialog()
            If frmInformationBox.Response = DialogResult.OK Then
                Exit Sub
            End If
        End If

        Dim frmExcelExport As New ExcelExport()
        frmExcelExport.Show()
        Cursor.Current = Cursors.AppStarting
        Application.DoEvents()

        Dim excelBook As Excel.Workbook = excelApp.Workbooks.Add
        Dim excelWorksheet As Excel.Worksheet = CType(excelBook.Worksheets(1), Excel.Worksheet)

from there you just build on your application.
 
Yes, it should work fine. Remember that Microsoft has built in version capability with Words eariler versions. So Word 2010 (hello Hal) should work fine with a Word 97 dll.
 
Ok, ive tested a simple program on another machine without office 97... Works great!!!
The only thing is that i need to copy also some files in the "debug" folder... Not a problem when deploy.
Very thanks for the help!!!
 
Back
Top