Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • *Experts*
Posted

Yep, its possible...first use a reference to the Office 97 dll. I've only used Word's spell check so I'm going to post an example of using Excel, knowing that they are very similar...and some web searching will probably get you the rest.

       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.

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Posted

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!

 

 

Yep, its possible...first use a reference to the Office 97 dll. I've only used Word's spell check so I'm going to post an example of using Excel, knowing that they are very similar...and some web searching will probably get you the rest.

       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.

  • *Experts*
Posted
Yes, it should work fine. Remember that Microsoft has built in version capability with Word's eariler versions. So Word 2010 (hello Hal) should work fine with a Word 97 dll.

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Posted

Ok, i've 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!!!

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...