View Single Post
 
Old 10-10-2020, 03:11 PM
Purfleet Purfleet is offline Windows 10 Office 2019
Expert
 
Join Date: Jun 2020
Location: Essex
Posts: 345
Purfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to behold
Default

I have never created a Word Macro, so this is a bit rudimentary, but maybe a proof of concept?

I think different monitor resolutions will need different numbers so you need to work out what is best and adjust w for width and h for height as required - my monitors are 1920x1080

You will need to put your file path in at the p variable and the file names in f1, f2 and f3.


Code:
Sub OpenFiles()

Dim l As Long ' left most position
Dim h As Long ' height of window
Dim w As Long ' width of window
Dim p As String 'file path
Dim f1 As String, f2 As String, f3 As String 'file names

p = "E:\" '<----- your file path
f1 = "One.docx" '<----- your left most file
f2 = "Two.docx" '<----- your next left most file
f3 = "Three.docx" '<----- your next left most file

l = 0 '<----- window starting point
w = 250 '<----- your window width
h = 800 '<----- your window height

'File 1
Documents.Open p & f1

With Tasks(f1)
    .WindowState = wdWindowStateNormal
    .Move Top:=0, Left:=l
    .Width = w
    .Height = h
End With

'File 2
Documents.Open p & f2

With Tasks(f2)
    .WindowState = wdWindowStateNormal
    .Move Top:=0, Left:=l + w
    .Width = w
    .Height = h
End With

'File 3
Documents.Open p & f3

With Tasks(f3)
    .WindowState = wdWindowStateNormal
    .Move Top:=0, Left:=l + w + w
    .Width = w
    .Height = h
End With

End Sub
Attached Files
File Type: docm Open Files Macro_Purfleet.docm (19.9 KB, 6 views)
Reply With Quote