Grazie caro!
Ora però mi da questo errore..... Libreria non registrata!
Per registrare la libreria è sufficiente "progetto - aggiungi riferimento" e quindi doppio click su "Microsoft Excel 11.0... "? o devo fare qualcos'altro?
graazzzzzzzzzzie
System.InvalidCastException non è stata gestita
Message="Impossibile eseguire il cast di oggetti COM di tipo 'Microsoft.Office.Interop.Excel.ApplicationClass' in tipi di interfaccia 'Microsoft.Office.Interop.Excel._Application'. L'operazione non è stata completata perché la chiamata QueryInterface sul componente COM per l'interfaccia con IID '{000208D5-0000-0000-C000-000000000046}' non è riuscita a causa del seguente errore: Libreria non registrata. (Eccezione da HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))."
Source="Microsoft.Office.Interop.Excel"
StackTrace:
in Microsoft.Office.Interop.Excel.ApplicationClass.ge t_Workbooks()
in WindowsApplication1.Scovaformule.Button1_Click(Obj ect sender, EventArgs e) in C:\Documents and Settings\martina\Documenti\Visual Studio 2008\Projects\Scovaformule\Scovaformule\Form1.vb:r iga 18
in System.Windows.Forms.Control.OnClick(EventArgs e)
in System.Windows.Forms.Button.OnClick(EventArgs e)
in System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
in System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
in System.Windows.Forms.Control.WndProc(Message& m)
in System.Windows.Forms.ButtonBase.WndProc(Message& m)
in System.Windows.Forms.Button.WndProc(Message& m)
in System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
in System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
in System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
in System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
in System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
in System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason, ApplicationContext context)
in System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context)
in System.Windows.Forms.Application.Run(ApplicationCo ntext context)
in Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.OnRun()
in Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.DoApplicationModel()
in Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.Run(String[] commandLine)
in WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:riga 81
in System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
in System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
in Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
in System.Threading.ThreadHelper.ThreadStart_Context( Object state)
in System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
in System.Threading.ThreadHelper.ThreadStart()
InnerException: