那我只是想结束for 语句的循环如何写呢。return好像不能实现。 msgbox(names.count) 不执行了。我这段代码是这样的。麻烦看看哪里错了
Dim Builder As New ADOXBuilder("渲奇表格数据")
Builder.Open() '打开ADOXBuilder
With Builder.Tables("进度表")
'Dim D As Date = Date.Today
Dim SD As Date = Date.Today.AddDays(-8).AddMonths(-1)
Dim ED As Date = Date.Today.adddays(1).AddMonths(1)
Dim nm As String = "sp" & SD.Year & "年" & SD.Month & "月_" & SD.Day
Dim nm2 As String = "sp" & ED.Year & "年" & ED.Month & "月_" & ED.Day
'sd = sd.Adddays(1)
Dim Names As New List(Of String) '111
For i As Integer = 0 To Tables("进度表").cols.Count '1 11
names.Add(i)
If Tables("进度表").cols(i).name = nm Then '111
Return
End If
Next
msgbox(names.count)
For i2 As Integer = 0 To names.count
If Tables("进度表").cols.Contains(Tables("进度表").cols(i2).name)=True Then
.DeleteColumn(Tables("进度表").cols(i2).name)
msgbox(Tables("进度表").cols(i2).name)
End If
Next
End With
[此贴子已经被作者于2018/10/6 12:33:38编辑过]