Dim oShell As Object, oExec As Object 'オブジェクト変数に参照をセットします Set oShell = CreateObject("WScript.Shell") Set oExec = oShell.Exec("C:\example.exe") '処理完了を待機 Do Until oExec.Status: DoEvents: Loop '戻り値をセット If Not oExec.StdErr.AtEndOfStream Then ExecCommand = True sResult = oExec.StdErr.ReadAll ElseIf Not oExec.StdOut.AtEndOfStream Then sResult = oExec.StdOut.ReadAll End If 'オブジェクト変数の参照を解放 Set oExec = Nothing: Set oShell = Nothing '結果を表示 MsgBox sResult
アイコンキャッシュのファイル「IconCache.db」を削除し、再起動します。
C:\Documents and Settings\Administrator\Local Settings\Application Data
DoCmd.FindRecord [FindWhat], [Match]
例1)
DoCmd.GoToControl "[検索するフィールドのコントロール]" DoCmd.FindRecord "[検索する文字列]", [検索タイプ]
例2)
[検索するフィールドのコントロール].SetFocus DoCmd.FindRecord "[検索する文字列]", [検索タイプ]
[検索タイプ]
acEntire=完全一致
acAnywhere=部分一致
acStart=検索文字列で始まる
Visual BasicでFileSystemObjectを使用し、
指定したディレクトリ内の全ファイル(サブディレクトリを含む)を読み込む。
全階層を再帰的に検索することができます。
■コマンドボタンに以下のようにコードを記述
Private Sub ファイル検索_Click() Dim strPath As String Dim fsObj As Object If Not IsNull("検索文字列") Then Set fsObj = CreateObject("Scripting.FileSystemObject") strPath = "調べたいディレクトリまでのフルパス" strKey = "検索文字列" 'ディレクトリ読み込み関数を呼び出し Call SearchSubDirectory(fsObj.GetFolder(strPath), strKey) 'オブジェクトを破棄 Set fsObj = Nothing End If End Sub