我希望你能在这里帮助我...我在 MS Access 2013 ( .accdb
) 中有一个应用程序。我在按钮单击上有一个文件对话框功能。(MSGBOX
函数用于调试!)
Private Sub Browse_btn_Click()
Dim path As String, initialPath As String
Dim fd As Object
MsgBox "Function Starts"
On Error GoTo errhnd
If IsNull(Me.RPE_Txt.value) Then initialPath = "C:\users\" & Environ("USERNAME") & "\" _
Else: initialPath = Me.RPE_Txt.value
MsgBox "Setting FD"
Set fd = Application.FileDialog(3)
On Error GoTo errhnd
With fd
MsgBox "in fd with statement"
.Title = "RPE File"
MsgBox "fd.initialview"
.InitialView = 2
.AllowMultiSelect = False
.Filters.Clear
.Filters.Add "Excel Files", "*.csv"
.InitialFileName = initialPath
MsgBox "show"
.Show
MsgBox "path"
path = .SelectedItems(1)
End With
MsgBox "end with"
Me.RPE_Txt.value = path
Exit Sub
errhnd:
MsgBox Err.Description, vbCritical, "Error: " & Err.Number
End Sub
当我在 MS Access Runtime 2010 上运行它时,当我单击按钮时出现标准运行时错误并且 Access 崩溃...
我尝试使用以下代码添加引用,但它在尝试中崩溃了..
If Application.Version = 14# Then
MsgBox "Office 2010"
If Dir("C:\Program Files\Common Files\microsoft shared\OFFICE14\MSO.DLL") <> "" And Not refExists("OFFICE") Then
MsgBox "Applying Reference for 2010 Office"
'Application.References.AddFromFile "C:\Program Files\Common Files\microsoft shared\OFFICE14\MSO.dll"
Application.References.AddFromGuid "{398E906A-826B-48DD-9791-549C649CACE5}", 14#, 14#
MsgBox "Office 2010 Reference Applied!"
End If
ElseIf Application.Version = 15# Then
MsgBox "Office 2013"
If Dir("C:\Program Files\Common Files\microsoft shared\OFFICE15\MSO.dll") <> "" And Not refExists("OFFICE") Then
MsgBox "Applying Reference for 2013 Office"
Application.References.AddFromFile "C:\Program Files\Common Files\microsoft shared\OFFICE15\MSO.dll"
MsgBox "Office 2013 Reference Applied!"
End If
End If
任何帮助,将不胜感激!
谢谢,皮特!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句