Ecco il codice:
__________________________________________________ ___________________________
Imports Microsoft.Office.Interop.Excel
Public Class Form1
Dim excel As Application
Dim cartella As Workbook
Dim foglio As Sheets
Dim CurSheet
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
excel = CreateObject("Excel.Application")
excel.Visible = 1
cartella = excel.Workbooks.Add
foglio = excel.ActiveWorkbook.Sheets
CurSheet = foglio.Item(1)
CurSheet.Name = "Tabella Parametri"
'CELLA A1
CurSheet.Range("A1").Formula = "PARAMETRO"
CurSheet.Range("A1").RowHeight = 20
CurSheet.Range("A1").ColumnWidth = 30
CurSheet.Range("A1").Interior.ColorIndex = 3
CurSheet.Range("A1").Select()
CurSheet.Range("A1").HorizontalAlignment = 3
CurSheet.Range("A1").VerticalAlignment = 2
CurSheet.Range("A1").Font.Name = "Arial Black"
CurSheet.Range("A1").Font.Size = 11
'BORDI
CurSheet.Range("A1:B2").borders.LineStyle = 0
CurSheet.Range("A1:B2").borders.Weight = 2
End Sub
End Class
__________________________________________________ ___________________________
Praticamente apre excel, lo rende visibile, crea un foglio e poi crea la tabella (c'è una sola cella altrimenti sarebbe troppo lungo).
A questo punto voglio salvarla, ma non posso usare SaveAs perchè altrimenti dovrei dare io il nome e la destinazione al file direttamente nel codice. Voglio invece che sia un ipotetico utente a poterlo scegliere, aprendo appunto la finestra Salva con Nome.