+ Reply to Thread
Results 1 to 2 of 2

how do I print .doc files from a list of pathnames in a spreadshee

  1. #1
    Dal
    Guest

    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. #2
    Ron de Bruin
    Guest

    Re: 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" <[email protected]> wrote in message news:[email protected]...
    >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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1