ExcelVBA 目次 - ray88’s diary
■各種ボタン処理 モジュール
Option Explicit Sub getLogFilePath() '------------------------------------------------- '機能 ログファイル格納フォルダパスの取得 '------------------------------------------------- Dim strPath As String strPath = fncGetFilePath If strPath = "" Then MsgBox "ファイル選択をキャンセルします" Exit Sub End If Sheets("Main").Range(strLogFilePathCell) = strPath End Sub Sub getOutputFolderPath() '------------------------------------------------- '機能 Output フォルダパスの取得 '------------------------------------------------- Dim strPath As String strPath = fncGetFolderPath If strPath = "" Then MsgBox "フォルダ選択をキャンセルします" Exit Sub End If Sheets("Main").Range(strOutputFolderPathCell) = strPath End Sub Sub clearLogFilePath() '------------------------------------------------- '機能 log格納フォルダのパスをクリアする '------------------------------------------------- Sheets("Main").Range(strLogFilePathCell) = "" End Sub Sub clearOutputFolderPath() '------------------------------------------------- '機能 log格納フォルダのパスをクリアする '------------------------------------------------- Sheets("Main").Range(strOutputFolderPathCell) = "" End Sub Sub getFolderPath(strRange As String) '------------------------------------------------- '機能: フォルダパスを取得して指定のセルに書き込む '引数1: 書き込み先セルアドレス '------------------------------------------------- Dim targetPath As String With Sheets("Main") targetPath = fncGetFolderPath If targetPath <> "" Then .Range(strRange) = targetPath Else MsgBox "フォルダ選択キャンセル" Exit Sub End If End With End Sub