Results 1 to 4 of 4

Printing of several Word files by specifying only the beginning of the ".doc" name

Threaded View

  1. #1
    Registered User
    Join Date
    05-27-2021
    Location
    Strasbourg, France
    MS-Off Ver
    2010
    Posts
    28

    Thumbs up Printing of several Word files by specifying only the beginning of the ".doc" name

    Hello everyone,

    I am desperately trying to run the code below.

    When I want to run the macro I get an error code "5151" that tells me that the program cannot find the file.

    My problem is the following, I would like to print the two word files in one program and indicating only the beginning of the file name (FMON027 and FMON036).

    Thank you in advance for your help!!!

    Sincerely

    Benten667

    Private Sub CommandButton1_Click()
    Dim WD As Object
    
        Set WD = CreateObject("Word.Application")
        
        WD.Documents.Open ("T:\Technique\" & "FMON027 *.docx")
        WD.ActiveDocument.PrintOut Background:=False
        WD.ActiveDocument.Close
        
        WD.Documents.Open ("T:\Technique\" & "FMON036 *.docx")
        WD.ActiveDocument.PrintOut Background:=False
        WD.ActiveDocument.Close
        
        WD.Quit
        Set WD = Nothing
    
    Unload Me
    End Sub
    Last edited by Benten667; 02-27-2023 at 03:26 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 10
    Last Post: 03-25-2020, 01:16 PM
  2. [SOLVED] Sort words between strings "Start" and "End"
    By jokris in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-07-2016, 01:31 PM
  3. How to count the words "true" and "false"?
    By tukae in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-09-2015, 03:19 AM
  4. If cell contains "word" then replace with "these words"
    By yellow281 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-21-2013, 07:19 PM
  5. Replies: 10
    Last Post: 01-26-2012, 08:26 AM
  6. Words in a list beginning with a letter "C"
    By jimwilliams in forum Excel General
    Replies: 2
    Last Post: 03-04-2009, 08:56 AM
  7. Remove "TRUE" "FALSE" words from a linked checkbox
    By MDCK in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-15-2008, 03:26 AM

Tags for this Thread

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