+ Reply to Thread
Results 1 to 4 of 4

getting run time error 1004: method activeprinterof object application failed.

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-29-2014
    Location
    India
    MS-Off Ver
    2010 Windows 10 64 bits
    Posts
    1,269

    getting run time error 1004: method activeprinterof object application failed.

    Hi friends,
    I want to save a workbook in PDF format using ‘doPDF v7’
    I’m getting run time error 1004: method activeprinterof object application failed.

    'Option Explicit
    
    Sub prttopdf()
        Dim rng As Range
        Dim DocName As String
        ‘Dim SaveFolder as … ‘suggest variable please
    
        SaveFolder = "C:\Users\admin\Desktop\"
        
        DocName = Range("B3").Value
        Filename = SaveFolder & DocName
        Set rng = Application.InputBox(Prompt:="Please Select Print Range", Title:="Print Range", Type:=8)
        rng.Select
        Application.ActivePrinter = "doPDF v7"    ' record macro to know printer name
        Selection.PrintOut Copies:=1, ActivePrinter:= _
      "doPDF v7", PrintToFile:=True, Collate:=True, prtofilename:=Filename
    End Sub
    Any help will be highly appreciated.

    Thanking you,
    Sincerely,

    mso3

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,962

    Re: getting run time error 1004: method activeprinterof object application failed.

    Did you record a macro to get the printer name? (which may not work with PDF, since you can just use

       ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
            FileName, Quality:= _
            xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
            OpenAfterPublish:=False
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Contributor
    Join Date
    06-29-2014
    Location
    India
    MS-Off Ver
    2010 Windows 10 64 bits
    Posts
    1,269

    Re: getting run time error 1004: method activeprinterof object application failed.

    Yes, I tried to record a macro to get printer name but in vain.
    I opened a workbook. Click on record macro. Give print command. Select doPdf v7 as printer but in recorded macro I didn't get a printer name.

    Please suggest me a proper way to get a printer name by recording macro.

    The code suggested by you is not working because there is no pdf option in save as file format.

    Thank you.

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,962

    Re: getting run time error 1004: method activeprinterof object application failed.


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Run-time error '1004' Method 'Range' of object'_Global' failed
    By mbie451 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-11-2014, 01:40 PM
  2. Run-time error '1004': Method 'Sheets' of object '_Global' failed
    By stigb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-21-2013, 03:35 PM
  3. Run-Time error 1004 Method 'OnTime' of object '_Application' failed
    By PBM in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-29-2013, 10:00 PM
  4. [SOLVED] Run-time error '1004': Method 'Worksheets' of object '_Global' failed
    By JSebastianRock in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-20-2013, 11:09 AM
  5. [SOLVED] Run time error 1004: method range of object _global failed
    By Danry in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-07-2012, 07:31 PM
  6. Run-time error '1004'. Method 'Range' of object '_Global' failed
    By mjj347 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-24-2012, 11:09 AM
  7. Run-time error '1004': Method 'Cells' of object _Global failed
    By Fran D in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-12-2006, 11:50 AM

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