J
Jennyfer Barco
Hello, I have a question, how can I open Microsoft Excel from .NET. I only
need to open a new file in Excel and paste some information and set the
Microsoft Excel as the enabled aplication, so the user can continue working
in Excel and he'll save the information I pasted. I tried this but doesn't
open Excel at all, but it does save the file c:\test.xls with the value
"This is column B row 2" in colum B and row 2:
Dim xlApp As Interop.Excel.Application
Dim xlBook As Interop.Excel.Workbook
Dim xlSheet As Interop.Excel.Worksheet
xlApp = CType(CreateObject("Excel.Application"), Interop.Excel.Application)
xlBook = CType(xlApp.Workbooks.Add, Interop.Excel.Workbook)
xlSheet = CType(xlBook.Worksheets(1), Interop.Excel.Worksheet)
' Place some text in the second row of the sheet.
xlSheet.Cells(2, 2) = "This is column B row 2"
' Show the sheet.
xlSheet.Application.Visible = True
' Save the sheet to C:\Test.xls directory.
xlSheet.SaveAs("C:\Test.xls")
Thanks in advance
Jennyfer
need to open a new file in Excel and paste some information and set the
Microsoft Excel as the enabled aplication, so the user can continue working
in Excel and he'll save the information I pasted. I tried this but doesn't
open Excel at all, but it does save the file c:\test.xls with the value
"This is column B row 2" in colum B and row 2:
Dim xlApp As Interop.Excel.Application
Dim xlBook As Interop.Excel.Workbook
Dim xlSheet As Interop.Excel.Worksheet
xlApp = CType(CreateObject("Excel.Application"), Interop.Excel.Application)
xlBook = CType(xlApp.Workbooks.Add, Interop.Excel.Workbook)
xlSheet = CType(xlBook.Worksheets(1), Interop.Excel.Worksheet)
' Place some text in the second row of the sheet.
xlSheet.Cells(2, 2) = "This is column B row 2"
' Show the sheet.
xlSheet.Application.Visible = True
' Save the sheet to C:\Test.xls directory.
xlSheet.SaveAs("C:\Test.xls")
Thanks in advance
Jennyfer