Thread: [Solved] open several word docs
View Single Post
 
Old 12-17-2022, 02:09 PM
BrianHoard BrianHoard is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: Jul 2022
Location: Haymarket, VA USA
Posts: 85
BrianHoard is on a distinguished road
Default

Does his help...

Method 1: Brute force way, just run Document.Open 10 times, each pointing to the full path of your documents.
Code:
Documents.Open FileName:="doc1.docx"
Documents.Open FileName:="doc2.docx"
Documents.Open FileName:="doc(n).docx"
Method 2: Loop through an array of your document names.
This could be useful if you're getting your doc names programmatically.
Code:
Dim arr_docs(9) As String ' Create a fixed sized array for 10 items.
' Populate each item in the array

arr_docs(0) = "doc1.docx"
arr_docs(1) = "doc2.docx"
' etc

' With all your docs stored in the array, loop through them to open them all.
For each doc in arr_docs
  Documents.Open FileName:=doc
Next doc
Reply With Quote