这个意思?
Dim result As DialogResult
result= messagebox.Show("请保证当前窗口的全部信息已经填写完毕或者显示完毕再进行生成SPC操作.","提示",MessageBoxButtons.OKCancel)
If result=DialogResult.OK Then
Dim b As New XLS.Book(ProjectPath & "Attachments\spc计量型控制.xlsx")
Dim t As Table = Tables("表A")
Dim s As XLS.Sheet = b.Sheets(0)
Dim Style As XLS.Style = b.NewStyle() '定义新样式
s.Cols(5).Style=Style
For r As Integer = 0 To t.Rows.Count - 1 '填入数据
For c As Integer = 0 To t.Cols.Count -1
s(r+56, c+2).Value = t.rows(r)(c)
Next
Next
b.Save(ProjectPath & "Attachments\spc计量型控制.xlsx")
Dim App As New MSExcel.Application
App.Visible = True
Dim Wb As MSExcel.Workbook = App.WorkBooks.Open(ProjectPath & "Attachments\spc计量型控制.xlsx")
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
app.ScreenUpdating=False
'工厂
Dim rg As MSExcel.Range = Ws.Cells(5,4)
rg.value=e.Form.Controls("TextBox1").text
'部门
Dim rg1 As MSExcel.Range = Ws.Cells(5,11)
rg1.value=e.Form.Controls("TextBox2").text
'零件号
Dim rg2 As MSExcel.Range = Ws.Cells(6,5)
rg2.value=e.Form.Controls("TextBox3").text
'零件描述
Dim rg3 As MSExcel.Range = Ws.Cells(6,11)
rg3.value=e.Form.Controls("TextBox4").text
'图纸编号
Dim rg4 As MSExcel.Range = Ws.Cells(7,5)
rg4.value=e.Form.Controls("TextBox5").text
'工程更改水平
Dim rg5 As MSExcel.Range = Ws.Cells(7,11)
rg5.value=e.Form.Controls("TextBox6").text
'模具编号
Dim rg6 As MSExcel.Range = Ws.Cells(8,5)
rg6.value=e.Form.Controls("TextBox7").text
'模腔数
Dim rg7 As MSExcel.Range = Ws.Cells(8,11)
rg7.value=e.Form.Controls("TextBox8").text
'描述
Dim rg8 As MSExcel.Range = Ws.Cells(9,5)
rg8.value=e.Form.Controls("TextBox9").text
'单位
Dim rg9 As MSExcel.Range = Ws.Cells(9,12)
rg9.value=e.Form.Controls("TextBox10").text
'尺寸规格
Dim rg10 As MSExcel.Range = Ws.Cells(10,4)
rg10.value=e.Form.Controls("NumericComboBox1").value
'上公差
Dim rg11 As MSExcel.Range = Ws.Cells(10,6)
rg11.value=e.Form.Controls("NumericComboBox2").value
'下公差
Dim rg12 As MSExcel.Range = Ws.Cells(10,8)
rg12.value=e.Form.Controls("NumericComboBox3").value
'日期
Dim rg13 As MSExcel.Range = Ws.Cells(4,25)
rg13.value=Date.Now().tostring()
'部门
app.screenupdating=True
End If