Hello Scott,
here is my code:
Dim Vorlagenverzeichnis As String = "...."
Dim aktWorkbook As String
Dim xlApp As New Excel.Application
Dim xlSheet As Excel.Worksheet
xlApp.Workbooks.Add(Template:=Vorlagenverzeichnis)
aktWorkbook = xlApp.ActiveWorkbook.Name
xlApp.Workbooks(aktWorkbook).Sheets("Master").Copy (After:=xlApp.Sheets(xlApp.ActiveWorkbook.Sheets.C ount))
xlApp.ActiveSheet.Name = "New Create"
xlSheet = xlApp.Workbooks(aktWorkbook).ActiveSheet
xlSheet.Delete()
xlApp.Application.Visible = True
This does not work, i add a reference to Excel 10 Com Object (vb.net 1.0 and
2.0)
I try a little bit last weekend and this one will work
May late binding is a better one to use
Dim Excel As Object
Excel = CreateObject("Excel.application")
With Excel
.SheetsInNewWorkbook = 4
.Workbooks.Add()
.Worksheets(1).Select()
.worksheets(1).Name = "Test"
.worksheets("Test").delete()
.activeWorkbook.close()
End With
Excel.Quit()
Excel = Nothing
GC.Collect()
Regards Rene
"Scott M." <s-***@nospam.nospamschrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP04.phx.gbl...
Let's see your entire code.
"Rene" <re************************@gmx.dewrote in message
news:uJ****************@TK2MSFTNGP04.phx.gbl...
>If you use excel vba, the code will be work.
If you using vb.net to build an Excel File you can´t delete a worksheet
in Excel with this typ of code.
vb.Net runs over the delete statement an nothing happens.
Sorry if my question is incomprehensibly
Rene
"Scott M." <s-***@nospam.nospamschrieb im Newsbeitrag
news:OR**************@TK2MSFTNGP05.phx.gbl...
>>And what was your VB.NET question?
"Rene" <re************************@gmx.dewrote in message
news:Og*************@TK2MSFTNGP06.phx.gbl...
Hi Proggies,
i try to delete an excel worksheet but nothing happens (work on vb.net
2005)
....
xlSheet = xlApp.Sheets("Master")
xlSheet.select
xlSheet.delete
also try
objWkb.Worksheets(sWksName).Delete
Where is the mistake ?
thx and nice weekend
Rene