我在访问中有一个 VBA 代码模块,它创建了 4 个新表并将它们添加到数据库中。我想在最后添加一个部分,通过自定义组在导航窗格中组织它们,以便它们全部组织起来。这可以通过vba实现吗?
编辑:
我不希望这些表位于未分配的对象组中。我想通过 VBA 更改该组的名称。
我试图让文件对话框弹出,以便用户可以选择一个文件路径以在 VBA 中导出文件,但由于某种原因,它会在以下代码行中引发此错误。
错误:对象“_Application”的方法“FileDialog”失败
代码: longResult = Application.FileDialog(msoFileDialogFolderPicker).Show
所有代码:
If choice = 6 Then
Dim intResult As Long
Dim strPath As String
'the dialog is displayed to the user
longResult = Application.FileDialog(msoFileDialogFolderPicker).Show
'checks if user has cancled the dialog
If intResult <> 0 Then
'dispaly message box
Call MsgBox(Application.FileDialog(msoFileDialogFolderPicker _
).SelectedItems(1), vbInformation, "Selected Folder")
End If
Else
End
End If
Run Code Online (Sandbox Code Playgroud)
我真的不确定如何解决这个问题。我检查了我的语法和一切。