Excel2007のVBAでプログラミング 解像度を取得する
ここを参考にして、画面解像度を取得して、それに合わせて、IEなどの表示位置を変えるようにしてみた。
Private Declare Function GetSystemMetrics _ Lib "user32" _ (ByVal nIndex As Long) As Long Private Const SM_CXSCREEN As Long = 0 Private Const SM_CYSCREEN As Long = 1 Sub test() Dim IE Dim ieAddress, msgContent As String Dim myX As Long, myY As Long ieAddress = Cells(1, 1).Value msgContent = Cells(2, 1).Value myX = GetSystemMetrics(SM_CXSCREEN) myY = GetSystemMetrics(SM_CYSCREEN) Set IE = CreateObject("InternetExplorer.Application") IE.navigate (ieAddress) IE.Left = 0 IE.Top = myY / 2 IE.Width = myX IE.Height = myY / 2 IE.Visible = True UserForm1.Label1.Caption = msgContent UserForm1.StartUpPosition = 0 UserForm1.Left = 0 UserForm1.Top = 0 UserForm1.Show vbModeless End Sub