那个红色代码执行时候出现《未设置对象变量或 With 块变量。》运行错误不知道原因。
Dim sfzh As Boolean = False '是否选择了身份证号
Dim sfzbs As Boolean = False '是否选择了身份标识
Dim Book As New XLS.Book '定义一个Excel工作簿
Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表
Dim h As Integer =0
Dim s As Integer = 1
For Each dc As DataRow In DataTables("基本信息").DataRows '基本信息的所有人的身份标识符遍历
Dim sfbsf As String = dc("身份标识符")
If h = 0 Then
Sheet(0,0).Value = "姓名"
If e.Form.Controls("CheckBox1").Checked Then
Sheet(0,s).Value = "身份证号"
s =s + 1
End If
If e.Form.Controls("CheckBox2").Checked Then
Sheet(0,s).Value = "身份标识"
s =s + 1
End If
For Each r As Row In Tables("表的表").GetCheckedRows
Sheet(0,s).Value = r("表名称")
s = s + 1
Next
End If
s = 0
Sheet(h + 1,s).Value = dc("姓名")
'Sheet(h + 1,s).Value = "1"
s = s + 1
If e.Form.Controls("CheckBox1").Checked Then
Sheet(h + 1,s).Value = dc("身份证号")
s =s + 1
End If
If e.Form.Controls("CheckBox2").Checked Then
Sheet(h + 1,s).Value = dc("身份标识符")
s =s + 1
End If
For Each r As Row In Tables("表的表").GetCheckedRows
Dim dr As DataRow
'dr = DataTables( r("表名称")).Find( "身份标识符 = 'E7F7620C0715A88'")
dr = DataTables( r("表名称")).Find( "身份标识符 = '" & dc("身份标识符") & "'")
Sheet(h + 1,s).Value =dr(r("表名称"))
'MessageBox.Show(dc("身份标识符"))
Next
h = h +1
Next