![]() |
how do I print .doc files from a list of pathnames in a spreadshee
I have list of .doc and .txt files in a spreadsheet. eg:
c:\myfolder\myfile1.doc c:\myfolder\myfile2.doc c:\myfolder\myfile3.txt I want to run a macro that prints the files without opening the application. i.e. I want to use a macro to effectively do the same as what happens when you right click a file icon in windows explorer and select the 'print' option. Any help appreciated. Thanks Dal |
how do I print .doc files from a list of pathnames in a spreadshee
hi Dal
With the path/file name in each cell in A1:A3 try this Sub test() Dim WD As Object Dim cell As Range For Each cell In Range("A1:A3") If cell.Value < "" Then If Dir(cell.Value) < "" Then Set WD = CreateObject("Word.Application") WD.Documents.Open (cell.Value) WD.ActiveDocument.PrintOut Background:=False WD.ActiveDocument.Close WD.Quit Set WD = Nothing End If End If Next cell End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Dal" wrote in message ... I have list of .doc and .txt files in a spreadsheet. eg: c:\myfolder\myfile1.doc c:\myfolder\myfile2.doc c:\myfolder\myfile3.txt I want to run a macro that prints the files without opening the application. i.e. I want to use a macro to effectively do the same as what happens when you right click a file icon in windows explorer and select the 'print' option. Any help appreciated. Thanks Dal |
All times are GMT +1. The time now is 06:11 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com