Multi file print
1 open Excel and save as xlsm extension
2 paste this code
3 set your folder path
4 set your file extension
5 run code
*****************
Sub PrintMultipleFiles()
Dim objWord As Object
Dim objDoc As Object
Dim strFolder As String
Dim strFile As String
' Set the folder path where your documents are located
strFolder = "C:\YourFolderPath\"
' Create an instance of Word
Set objWord = CreateObject("Word.Application")
objWord.Visible = False ' Set to True if you want Word to be visible
' Loop through each file in the folder
strFile = Dir(strFolder & "*.doc") ' Change the file extension if necessary
Do While strFile <> ""
' Open the document
Set objDoc = objWord.Documents.Open(strFolder & strFile)
' Print the document
objDoc.PrintOut
' Close the document
objDoc.Close
' Get the next file
strFile = Dir
Loop
' Close Word and clean up
objWord.Quit
Set objWord = Nothing
End Sub
Comments
Post a Comment