Sub Sample1() Dim PicFile As String PicFile = Application.GetOpenFilename() If PicFile = "False" Then Exit Sub ActiveSheet.Pictures.Insert PicFile End Sub
Sub Sample2() Dim PicFile As String PicFile = Application.GetOpenFilename() If PicFile = "False" Then Exit Sub ActiveSheet.Pictures.Insert PicFile With ActiveSheet.Pictures(1) MsgBox .Width & " × " & .Height End With End Sub
Sub Sample3() Dim PicFile As String, P PicFile = Application.GetOpenFilename() If PicFile = "False" Then Exit Sub ''選択した画像ファイルをバリアント型変数に格納する Set P = LoadPicture(PicFile) With ActiveSheet.Pictures(1) MsgBox CLng(P.Width * 0.0378) & " × " & CLng(P.Height * 0.0378) End With End Sub