masterx81 Posted March 10, 2005 Posted March 10, 2005 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 Quote
*Experts* DiverDan Posted March 11, 2005 *Experts* Posted March 11, 2005 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. Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
masterx81 Posted March 11, 2005 Author Posted March 11, 2005 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. Quote
*Experts* DiverDan Posted March 11, 2005 *Experts* Posted March 11, 2005 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. Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
masterx81 Posted March 11, 2005 Author Posted March 11, 2005 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!!! Quote
Recommended Posts