Skip to content

Instantly share code, notes, and snippets.

@honda0510
Created February 1, 2011 08:42
Show Gist options
  • Save honda0510/805595 to your computer and use it in GitHub Desktop.
Save honda0510/805595 to your computer and use it in GitHub Desktop.
【Access VBA, moug】アクセスVBAでフォルダを開く http://www.moug.net/faq/viewtopic.php?t=56729
Option Compare Database
Option Explicit
Sub test()
Dim path, action
path = TestGetFileName
action = "open" 'Print
fileAction path, action
End Sub
Function TestGetFileName()
Const ENABLE_WIZHOOK = 51488399
Const DISABLE_WIZHOOK = 0
Dim strFile As String
Dim intResult As Integer
WizHook.Key = ENABLE_WIZHOOK ' WizHook 有効化
intResult = WizHook.GetFileName( _
0, "", "", "", strFile, "", _
"すべてのファイル (*.*)|*.*", _
0, 0, 0, True _
)
WizHook.Key = DISABLE_WIZHOOK ' WizHook 無効化
TestGetFileName = strFile
End Function
Sub fileAction(path, action)
Dim shell, fso, folder, file
Set fso = CreateObject("Scripting.FileSystemObject")
Set shell = CreateObject("Shell.Application")
Set folder = shell.Namespace(fso.GetParentFolderName(path))
Set file = folder.ParseName(fso.GetFileName(path))
file.InvokeVerbEx action
End Sub
@honda0510
Copy link
Author

アクセスVBAでフォルダを開く
http://www.moug.net/faq/viewtopic.php?t=56729

ファイルを開く ダイアログを表示する方法
http://www.f3.dion.ne.jp/~element/msaccess/AcTipsGetFileName.html

スクリプトを使用してテキスト ファイルを印刷することはできますか
http://www.f3.dion.ne.jp/~element/msaccess/AcTipsGetFileName.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment