PDA

View Full Version : VB.net Help...Like in a bad way


j
13 Oct 2005, 4:41pm
I have a VB.net application that opens an excel file and writes to some cells. It's using the Microsoft office excel 11.0 referance. It works great on my PC. It is running windows XP and Office 2003. I created a deployment package and installed it on my PC and another XP machine and both worked great. However, when I install it on a windows 2000 machine with Office 2003 it gives me a System.runtime.interopservice.Comexception error.

What am I missing? Please for the love of all things Binary I need help.

Here is some code snippits

Imports Excel = Microsoft.Office.Interop.Excel

Public Class Form1
Inherits System.Windows.Forms.Form
Dim MyExcel As New Excel.Application 'create new excel object
Dim WB As Excel.Workbook 'Make a workbook instance
Dim WBsheet As Excel.Worksheet 'make a worksheet instance

///....


This is were the exception is pointing too..Only on the 2000 machines.
Private Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer.Tick
///....
If (Log = True) Then
DataLog = DataLog + 1
WBsheet.Cells(DataLog, 1) = Time / 1000
WBsheet.Cells(DataLog, 2) = RawData
WBsheet.Cells(DataLog, 3) = AverageData
WBsheet.Cells(DataLog, 4) = AverageNum
WBsheet.Cells(DataLog, 5) = DynamicBottom
WBsheet.Cells(DataLog, 6) = ActivationBottom
WBsheet.Cells(DataLog, 7) = ValveCondition
End If
End Sub

primesuspect
13 Oct 2005, 6:12pm
Is the .NET framework installed on the Win2000 machine? And is it the latest version/patch? ( I believe the latest is 1.1 sp1)

j
13 Oct 2005, 6:24pm
Yep, both have version 1.1

Shorty
13 Oct 2005, 6:56pm
COM exceptions would indicate to me that you have some com object dependancy issue going on.

Open admin tools -> component services and see what you have on both machines and compare if you are missing a com component.

Additionally, if you can install visual studio .net onto the Win2K box, check if VS.net can see the reference you added.

j
13 Oct 2005, 7:58pm
We put .net on the 2000 machine and it see's all the refeances. The point at which it crashes seems to be only when I write to the cell. I can do every thing else but I just can't modifiy the work sheet. I check to see if it's read only but it's not

j
13 Oct 2005, 10:06pm
Ok I figured it out. Here was the problem

Works.
WBsheet.Range("a" & DataLog, "a" & DataLog).Value = Time / 1000

Does not work.
WBsheet.Cells(DataLog, 1) = Time / 1000


Funny thing is "WBsheet.Cells(DataLog, 1) = Time / 1000" works on XP, but not 2000. F%^k'n microsoft