+ Reply to Thread
Results 1 to 3 of 3

Macro in Excel to print a word file/page#

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-08-2007
    Location
    St. Augustine, Fl
    MS-Off Ver
    Excel 2021 for Mac
    Posts
    392

    Macro in Excel to print a word file/page#

    I got this Macro to print the file I wanted but it has 55 pages. I only want to print a specific page. How do I get this to work? Please Email at
    [email protected].
    Thanks,
     
    Sub PrintWordDoc()
        Dim oWord As Object
        Dim sPath As String
        Dim iCnt  As Integer
         
         'Path to Master Cook Recipes 8-05.doc in same folder as workbook
        sPath = ThisWorkbook.Path & Application.PathSeparator & "H://Bradley Word/Master Cook Recipes 8-05.doc"
         
         'Ask copy count
        iCnt = Val(InputBox("How many copies", "Print Word doc", 1))
         
         'If any
        If iCnt >= 1 Then
             
             'Create word application
            Set oWord = CreateObject(Class:="Word.Application")
             
             'Open document sPath en printout wanted copies
            With oWord.Documents.Open("H://Bradley Word\Master Cook Recipes 8-05.doc")
                .PrintOut Background:=False, Copies:=iCnt
                .Close False
            End With
             
             'Quit word application
            oWord.Quit False
        End If
         
         'Clean up
        Set oWord = Nothing
    End Sub
    Please Wrap your code !!!
    Last edited by VBA Noob; 03-15-2007 at 02:35 PM.

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Your question is not an Excel question ... it is Word ...
    see link
    http://word.mvps.org/FAQs/MacrosVBA/SelectCurPage.htm
    HTH
    Carim


    Top Excel Links

  3. #3
    Forum Contributor
    Join Date
    03-08-2007
    Location
    St. Augustine, Fl
    MS-Off Ver
    Excel 2021 for Mac
    Posts
    392
    Thanks, I'll give this a try. I'm really new at this.

+ 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