Hallo,
habe bisher diesen Code, welcher mir aus meinen TextBox1-24 auf Knopfdruck die Informationen holt und in ein Excel sheet speichert.
Funktioniert ganz gut.
Nun aber zwei Fragen:
a) Wie kann ich das mit den Zellen und Textboxzuweisungen verschönen (bisher kopierte Zeilen mit anderen Zahlen --> unschön)
b) Bisher speichert es mir meine Mappe an einem fest zugeordneten platz, wie kann ichs machen, dass er mich fragt wo er es speichern soll?
Vielen Dank für euere Antworten
habe bisher diesen Code, welcher mir aus meinen TextBox1-24 auf Knopfdruck die Informationen holt und in ein Excel sheet speichert.
VB.NET-Quellcode
- Private Sub Button1_Click_1(sender As System.Object, e As System.EventArgs) Handles Button1.Click
- Dim Excel As Object, Workbook As ObjectExcel = CreateObject("Excel.Application")Workbook = Excel.Workbooks.OpenXML("B:\Mappe1.xlsx")
- Workbook.Sheets(1).Cells(4, 1).Formula = TextBox1.Text
- Workbook.Sheets(1).Cells(5, 1).Formula = TextBox2.Text
- Workbook.Sheets(1).Cells(6, 1).Formula = TextBox3.Text
- Workbook.Sheets(1).Cells(7, 1).Formula = TextBox4.Text
- Workbook.Sheets(1).Cells(8, 1).Formula = TextBox5.Text
- Workbook.Sheets(1).Cells(9, 1).Formula = TextBox6.Text
- Workbook.Sheets(1).Cells(4, 2).Formula = TextBox7.Text
- Workbook.Sheets(1).Cells(5, 2).Formula = TextBox8.Text
- Workbook.Sheets(1).Cells(6, 2).Formula = TextBox9.Text
- Workbook.Sheets(1).Cells(7, 2).Formula = TextBox10.Text
- Workbook.Sheets(1).Cells(8, 2).Formula = TextBox11.Text
- Workbook.Sheets(1).Cells(9, 2).Formula = TextBox12.Text
- Workbook.Sheets(1).Cells(4, 3).Formula = TextBox13.Text
- Workbook.Sheets(1).Cells(5, 3).Formula = TextBox14.Text
- Workbook.Sheets(1).Cells(6, 3).Formula = TextBox15.Text
- Workbook.Sheets(1).Cells(7, 3).Formula = TextBox16.Text
- Workbook.Sheets(1).Cells(8, 3).Formula = TextBox17.Text
- Workbook.Sheets(1).Cells(9, 3).Formula = TextBox18.Text
- Workbook.Sheets(1).Cells(4, 4).Formula = TextBox19.Text
- Workbook.Sheets(1).Cells(5, 4).Formula = TextBox20.Text
- Workbook.Sheets(1).Cells(6, 4).Formula = TextBox21.Text
- Workbook.Sheets(1).Cells(7, 4).Formula = TextBox22.Text
- Workbook.Sheets(1).Cells(8, 4).Formula = TextBox23.Text
- Workbook.Sheets(1).Cells(9, 4).Formula = TextBox24.Text
- Excel.ActiveWorkbook.Save()
- Workbook.Close()
- End Sub
Funktioniert ganz gut.
Nun aber zwei Fragen:
a) Wie kann ich das mit den Zellen und Textboxzuweisungen verschönen (bisher kopierte Zeilen mit anderen Zahlen --> unschön)
b) Bisher speichert es mir meine Mappe an einem fest zugeordneten platz, wie kann ichs machen, dass er mich fragt wo er es speichern soll?
Vielen Dank für euere Antworten