i have been working with visual studio 2005 express and would like to learn more about c#can someone assist in converting the code below its used from button 1 click on a windows form.
Dim xlApp As Microsoft.Office.Interop.Excel.Application
Dim xlBook As Microsoft.Office.Interop.Excel.Workbook
xlApp = CType(CreateObject("Excel.Application"), _
Microsoft.Office.Interop.Excel.Application)
xlBook = CType(xlApp.Workbooks.Open("C:\Program Files\Bernie\Co Books") _
, Microsoft.Office.Interop.Excel.Workbook)
xlApp.Application.Visible = True
Me.Close()

changing visual studio 2005 code to c#
Martin Svadbik
SteveLe
SohaibM
Thankyou for your reply Daniel i have put the reference for my excel document where the filename is ie "C:\\Documents & Settings\\Bernie\\My Docs\\etc" but i get the error message com exception unhandled cannot find C:etc.By the way i am using Visual C# Express Edition but it shouldnt make a difference as it doesnt in Visual Studio 2005 Express Edition with the code i originally gave you,any thoughts
Regards Bernie
mgi1100
Use System.Reflection.Missing.Value for the missing arguments.
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter and VB to C++ converter
Instant J#: VB to J# converter
Clear VB: Cleans up VB.NET code
Clear C#: Cleans up C# code
Raimund
Microsoft.Office.Interop.Excel.
Application xlApp;Microsoft.Office.Interop.Excel.Workbook xlBook;
xlApp = (Microsoft.Office.Interop.Excel.Application) Activator.CreateInstance(Type.GetTypeFromProgID("Excel.Application"));
xlBook = (Microsoft.Office.Interop.Excel.Workbook)xlApp.Workbooks.Open(fileName, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
The whole list of Type.Missing is required because C# doesn't support optional parameters.
basin
Bob Sovers