Ms access VBA-编译错误:应为:If或Select或Sub或Function或Property或Type或With或Enum或end-of语句
请原谅我的问题。在VBA工作不是我的正常工作 我在标题中列出了错误。违规代码如下:Ms access VBA-编译错误:应为:If或Select或Sub或Function或Property或Type或With或Enum或end-of语句,ms-access,while-loop,vba,compiler-warnings,Ms Access,While Loop,Vba,Compiler Warnings,请原谅我的问题。在VBA工作不是我的正常工作 我在标题中列出了错误。违规代码如下: While index <= 10 index = index + 1 End While 问题中引用的索引链接是VB.net示例,它与VBA有相似之处,在一些简单示例中,很容易混淆。将End While替换为Wend或使用Do…Loop结构 回顾:Do While indexWhile…Wend是一个过时的循环构造。改为使用Do While…Loop。这样,您就可以执行退出do(在没有转到的情况
While index <= 10
index = index + 1
End While
问题中引用的索引链接是VB.net示例,它与VBA有相似之处,在一些简单示例中,很容易混淆。将
End While
替换为Wend
或使用Do…Loop
结构
回顾:
Do While indexWhile…Wend
是一个过时的循环构造。改为使用Do While…Loop
。这样,您就可以执行退出do
(在没有转到的情况下不能跳出。)您正在查看的文档是VB.NET,而不是VBA。
Private Sub btnExpAll_Click()
Dim sFldr As String
sFldr = BrowseFolder("Where do you want to export the files?")
If sFldr = "" Then Exit Sub
DoCmd.Hourglass True
Dim sListLocal As String
Dim index As Integer
Dim strInputFileNameLocal As String
sListLocal = ""
index = 0
While index <= 10
index = index + 1
End While
strInputFileNameLocal = sFldr & "\list-local.html"
Open strInputFileNameLocal For Output As #1
Print #1, sListLocal
Close #1
DoCmd.Hourglass False
End Sub