pdf ファイル名を指定している所は変更して下さい。
Option Explicit
'
Declare Function GetForegroundWindow Lib "user32" () As Long
'
Declare Sub Sleep Lib "kernel32" ( _
ByVal dwMilliseconds As Long)
'
Declare Function SetWindowPos Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByVal hWndInsetAfter As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal uFlags As Long) As Long
'
Sub Macro1()
Dim Width As Long
Dim Height As Long
'
With Application
.WindowState = xlMaximized
CreateObject("Shell.Application").ShellExecute _
"C:\Users\MA\Desktop\My Documents\質問解答\OKWAVE\q10077917.pdf"
Width = GetForegroundWindow
'
Do While Width = GetForegroundWindow
Sleep 100
Loop
Sleep 1000
Width = .Width * 2 / 3
Height = .Height * 4 / 3 - 9
SetWindowPos GetForegroundWindow, -1, _
Width + .Left * 3, 0, Width - .Left, Height, 4
Width = .Width / 2 + .Left
Height = .Height
.WindowState = xlNormal
.Left = 0
.Top = 0
.Width = Width
.Height = Height
End With
End Sub
やむ負えず、WINDOWS10にアップグレードしたら、ウインドウを左右に並べて表示が使えなくなり、私自身が必要になったので作りました。
世の中だんだん不便になりますね。