Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to print a bunch of files form the list (excel)? | Excel Discussion (Misc queries) | |||
macro to print files from a list of links | Excel Discussion (Misc queries) | |||
how do i print a list of files in a folder in excel? | New Users to Excel | |||
List box or combo box on an Excel spreadshee... | Excel Worksheet Functions | |||
How Do I Run Subroutines in .xla files from VBA Code in Spreadshee | Excel Programming |