Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dal Dal is offline
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to print a bunch of files form the list (excel)? Tojkior Excel Discussion (Misc queries) 0 June 9th 08 01:55 PM
macro to print files from a list of links jim9912 Excel Discussion (Misc queries) 7 April 25th 06 05:43 PM
how do i print a list of files in a folder in excel? mikie New Users to Excel 4 June 6th 05 04:27 AM
List box or combo box on an Excel spreadshee... city Excel Worksheet Functions 1 April 7th 05 09:31 PM
How Do I Run Subroutines in .xla files from VBA Code in Spreadshee John Loo Excel Programming 3 November 3rd 04 12:21 AM


All times are GMT +1. The time now is 03:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"