Created
February 1, 2011 08:42
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
アクセス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