'
'******** AKIRA55.COM ******* https://akira55.com/shortcut/
'
Sub shortcut02() 'デスクトップ上にファイルのショートカットを作成する
Dim WshShell As Object
Dim DeskTopPath, ShortCutPath As String
Set WshShell = CreateObject("WScript.Shell") 'WshShellオブジェクトを作成
DeskTopPath = WshShell.SpecialFolders("Desktop") 'デスクトップパスを取得する
ShortCutPath = DeskTopPath & "\" & ThisWorkbook.Name & ".lnk" 'ショートカット名の指定(このブックのショートカット名)
With WshShell.CreateShortcut(ShortCutPath)
.TargetPath = ThisWorkbook.FullName 'ショートカットのリンク先を設定(このブック)
.Save 'ショートカットの保存実行
End With
Set WshShell = Nothing
End Sub
'
'
'******** AKIRA55.COM ******* https://akira55.com/shortcut/
'
Sub shortcut03() 'デスクトップ上にインターネットURLのショートカットを作成する
Dim WshShell As Object
Dim DeskTopPath, ShortCutPath As String
Set WshShell = CreateObject("WScript.Shell") 'WshShellオブジェクトを作成
DeskTopPath = WshShell.SpecialFolders("Desktop") 'デスクトップパスを取得する
ShortCutPath = DeskTopPath & "\" & "Yahoo!JAPAN.URL" 'ショートカット名の指定(URLショートカット名)
With WshShell.CreateShortcut(ShortCutPath)
.TargetPath = "https://www.yahoo.co.jp/" 'ショートカットのリンク先を設定(YahooのURLを指定)
.Save 'ショートカットの保存実行
End With
Set WshShell = Nothing
End Sub
'
'
'******** AKIRA55.COM ******* https://akira55.com/shortcut/
'
Sub shortcut04() 'デスクトップ上にペイント(アプリケーション)のショートカットを作成する
Dim WshShell As Object
Dim DeskTopPath, ShortCutPath As String
Set WshShell = CreateObject("WScript.Shell") 'WshShellオブジェクトを作成
DeskTopPath = WshShell.SpecialFolders("Desktop") 'デスクトップパスを取得する
ShortCutPath = DeskTopPath & "\" & "ペイント.lnk" 'ショートカット名の指定(ペイント)
With WshShell.CreateShortcut(ShortCutPath)
.TargetPath = "%windir%\system32\mspaint.exe" 'ショートカットのリンク先を設定(ペイントのEXEを指定)
.Save 'ショートカットの保存実行
End With
Set WshShell = Nothing
End Sub
'