Private Sub ファイル名_Click()
'事前にAccessのテーブルにハイパーリンク型でファイル名を入れておく
'フォームで表示されたファイル名をクリックすると、そのファイルが開く...((φ(゚ω゚ )メモメモ
Dim FSO As Variant
Dim Ex As Variant
Dim str_Path As String
Dim File_Path As String
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Ex = CreateObject("Excel.Application")
'フォルダパスを取得
str_Path = DLookup("フォルダパス", "T_テスト2")
'ファイルパスを作成
File_Path = FSO.BuildPath(str_Path, ファイル名.Text)
'Excelファイルを開く
Ex.workbooks.Open (File_Path)
'Excelファイルを表示する
Ex.Visible = True
Set Ex = Nothing
Set FSO = Nothing
MsgBox ファイル名.Text & "を開きました。", vbInformation, "ファイルを開く"
End Sub
'Accessのタブコントロールでタブを変える時に発生するイベント
'Form_タブフォーム内のイベント...((φ(゚ω゚ )メモメモ
Private Sub テスト1_Change()
MsgBox Me.テスト1.Pages(Me!テスト1.Value).Name
End Sub
''読み込み時にフォームの幅と高さを設定する
'Private Sub Form_Load()
'
'DoCmd.MoveSize , , 20 * 567, 10 * 567
'
'End Sub
More than 1 year has passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme