C
cappa
hi,
i'm a newbie for visualbasic .net and excel so i hope that you can
suggest me some way to solve my problem.
i'll try to explain:
then 've created my application in visual basic.net, a feature is that
i i write on a excel template some data and after i can view a graph
in local i don't have any problem, but if i try to install in other pc
i reach (for now) 2 error:
System.Runtime.InteropServices.COMException (0x80028018): Old format or
type library not valid.
at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object
o, Type objType, String name, Object[] args, String[] paramnames,
Boolean[] CopyBack)
at pumadotnet.frmverifica.btnexcel_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
in this case there's a different version of excel installed.
or i find this:
Cannot create ActiveX component
in this case there's no excel installed.
So i've noted that in the setup packet of my application, .net
automatically include "Excel.exe", "MS0.dll" ,
"Interop.Excel.dll","Interop.Microsoft.Office.Core.dll"
and i would know if with only this file i can use my .net and excel
application.
Or could you suggest me some solution?
thanks
cappa
This is the code that i use:
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Dim oChart As Object
Dim cellAdress As String
Dim nomeFile As String
Dim i, j, cnt As Long
oExcel =CreateObject("Excel.Application")
oExcel.Visible = True
nomeFile = pathpuma & "\db\Report.xlt"
oBook = oExcel.Workbooks.Open(FileName:=nomeFile)
oSheet = oBook.worksheets(1)
oSheet.Range("B5").Value = Qaria
oSheet.Range("B6").Value = Qfumi
oSheet.Range("B7").Value = Nt
oSheet.Range("B8").Value = Drecuperatore
oSheet.Range("B9").Value = De
oSheet.Range("B10").Value = H
For i = 0 To Nz - 1
oSheet.Range("B" & 13 + i).Value = i * H / Nz
oSheet.Range("C" & 13 + i).Value = Temp(1, i)
oSheet.Range("D" & 13 + i).Value = Temp(3, i)
oSheet.Range("E" & 13 + i).Value = Temp(2, i)
Next i
oBook.Sheets("Grafico").Select()
oChart = oBook.ActiveChart
oChart.SetSourceData(Source:=oSheet.Range("B12:E" & (13 + Nz)),
PlotBy:="Dati!B13:E" & 13 + Nz)
i'm a newbie for visualbasic .net and excel so i hope that you can
suggest me some way to solve my problem.
i'll try to explain:
then 've created my application in visual basic.net, a feature is that
i i write on a excel template some data and after i can view a graph
in local i don't have any problem, but if i try to install in other pc
i reach (for now) 2 error:
System.Runtime.InteropServices.COMException (0x80028018): Old format or
type library not valid.
at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object
o, Type objType, String name, Object[] args, String[] paramnames,
Boolean[] CopyBack)
at pumadotnet.frmverifica.btnexcel_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
in this case there's a different version of excel installed.
or i find this:
Cannot create ActiveX component
in this case there's no excel installed.
So i've noted that in the setup packet of my application, .net
automatically include "Excel.exe", "MS0.dll" ,
"Interop.Excel.dll","Interop.Microsoft.Office.Core.dll"
and i would know if with only this file i can use my .net and excel
application.
Or could you suggest me some solution?
thanks
cappa
This is the code that i use:
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Dim oChart As Object
Dim cellAdress As String
Dim nomeFile As String
Dim i, j, cnt As Long
oExcel =CreateObject("Excel.Application")
oExcel.Visible = True
nomeFile = pathpuma & "\db\Report.xlt"
oBook = oExcel.Workbooks.Open(FileName:=nomeFile)
oSheet = oBook.worksheets(1)
oSheet.Range("B5").Value = Qaria
oSheet.Range("B6").Value = Qfumi
oSheet.Range("B7").Value = Nt
oSheet.Range("B8").Value = Drecuperatore
oSheet.Range("B9").Value = De
oSheet.Range("B10").Value = H
For i = 0 To Nz - 1
oSheet.Range("B" & 13 + i).Value = i * H / Nz
oSheet.Range("C" & 13 + i).Value = Temp(1, i)
oSheet.Range("D" & 13 + i).Value = Temp(3, i)
oSheet.Range("E" & 13 + i).Value = Temp(2, i)
Next i
oBook.Sheets("Grafico").Select()
oChart = oBook.ActiveChart
oChart.SetSourceData(Source:=oSheet.Range("B12:E" & (13 + Nz)),
PlotBy:="Dati!B13:E" & 13 + Nz)