+ Reply to Thread
Results 1 to 15 of 15

PDF-printer problem

  1. #1
    Registered User
    Join Date
    08-05-2011
    Location
    Kaavi
    MS-Off Ver
    Excel 2007
    Posts
    45

    PDF-printer problem

    Hello, I have a problem like this;

    I've recorded macro that selects PDF-printer, converts wanted range into PDF, then opens email application and user can send range to wanted address. Problem is that every time I record macro, it works fine, just like i want it to work.. but when I close workbook, then open it again and run macro, it does not do anything I recorded :P It does select pdf-printer (sometimes) but it wants me to save file (didn't record anything like that), and sometimes it just prints range into paper :P

    Is this macro ruined somehow or doesn't it just work ??

    Point is that user selects "Send PDF", macro then selects PDF-printer, then opens email application where user can write address. All this is working but when I close workbook and then open it, won't work :P

    Here's the code

    Please Login or Register  to view this content.
    Last edited by Crüe; 08-17-2011 at 06:50 AM.

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: PDF-printer problem

    Hello Crüe, I've removed the lines of code that are only imitations of what you were doing, like scrolling your sheet and selecting A26 after your printout and this is what is left
    Please Login or Register  to view this content.
    Your code does not select a pdf printer, it uses whatever printer is default. Also, your code does not open an email. It just selects a Range called RANGE and then prints it to the default printer.
    Another note worth mentioning is your name usage for a range. Range is a reserved word in VBA and it is not typically good practice to use the same names as reserved names. Perhaps something like Rng1 would be better as it is countable and not reserved.
    We can help you with a procedure that will do what you want but I personally won't be back on for another 6 or 7 hours as it is 1:14 am where I am and I need to get some sleep .
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Valued Forum Contributor gjlindn's Avatar
    Join Date
    08-01-2011
    Location
    Dodgeville, WI
    MS-Off Ver
    Excel 2003, 2007, 2010, 2013
    Posts
    369

    Re: PDF-printer problem

    I think you need to always specify the active printer.
    Please Login or Register  to view this content.
    EDIT: I also agree with Mordred...I would refrain from using RANGE as a named range.
    -Greg If this is helpful, pls click Star icon in lower left corner

  4. #4
    Registered User
    Join Date
    08-05-2011
    Location
    Kaavi
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: PDF-printer problem

    I recorded a new one, is this any better ? Yeah I would greatly approciate if I get this done. OK I'll take another shot changing line

    Please Login or Register  to view this content.
    Last edited by Crüe; 08-08-2011 at 02:25 AM.

  5. #5
    Valued Forum Contributor gjlindn's Avatar
    Join Date
    08-01-2011
    Location
    Dodgeville, WI
    MS-Off Ver
    Excel 2003, 2007, 2010, 2013
    Posts
    369

    Re: PDF-printer problem

    In order to have it send email, too, we'd need to know what the email application you're using is (my guess is MS Outlook). Also, is the intent to send the same information via workbook attachment, data pasted into the body of the email (if so what format), or attached PDF file that the user saves. And like Mordred, it's 1:30am here so I'll be offline until tomorrow and busy with work until 6pm. I'm sure there are members here who can get you on track before then, though. Thanks!

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: PDF-printer problem

    You've not paid any attention to the help given previously. The new coe still has the scrolling code which is unnecessary.

    Also, if you change printers you need to change them back again.

    Please Login or Register  to view this content.
    For full pdf code & emailing options see Ron de Bruin's site
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  7. #7
    Registered User
    Join Date
    08-05-2011
    Location
    Kaavi
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: PDF-printer problem

    I'm using Windows Live Mail. What I want is to send this "myRANGE (etc.)" via email as an email attachment. Macro I posted before works like this, after it has converted wanted range to PDF, it opens this Teamware mailing application with this range as an attachment. Then I just need to select right email address and send it.

    I'm trying to pay attention, my english is just little bit rusty so I need to do this very simple and easy.
    Last edited by Crüe; 08-10-2011 at 05:39 AM.

  8. #8
    Valued Forum Contributor gjlindn's Avatar
    Join Date
    08-01-2011
    Location
    Dodgeville, WI
    MS-Off Ver
    Excel 2003, 2007, 2010, 2013
    Posts
    369

    Re: PDF-printer problem

    @royUK: Excellent point on switching things back (printer in this case)...users absolutely HATE their settings changed

  9. #9
    Registered User
    Join Date
    08-05-2011
    Location
    Kaavi
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: PDF-printer problem

    It would be so easy to copy Ron's code which creates pdf-files and then emails them. But I got an error 'cuz I'm not using Outlook :P

    Set OutApp = CreateObject("Outlook.Application")

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: PDF-printer problem

    You could look at Ron's code for sending with CDO

  11. #11
    Registered User
    Join Date
    08-05-2011
    Location
    Kaavi
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: PDF-printer problem

    Could you paste where I can find that?

  12. #12
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: PDF-printer problem

    It's on his site

    http://www.rondebruin.nl/cdo.htm

    Also,Your post does not comply with Rule 5 of our Forum RULES. We have Seven question forums: Miscellaneous, General, Programming, Worksheet Functions, Charting, Excel 2007 Help and New Users. Please choose the appropriate forum, and post your question in ONLY one forum.
    I've moved it

  13. #13
    Registered User
    Join Date
    08-05-2011
    Location
    Kaavi
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: PDF-printer problem

    It's not working, I'm done with this :P I'm losing my nerves...

  14. #14
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: PDF-printer problem

    We can't help if you don't say what's not working.

  15. #15
    Registered User
    Join Date
    08-05-2011
    Location
    Kaavi
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: PDF-printer problem

    Never mind, this goes beyond my vba-abilities :P I found a code from Ron's site, it simply just emails wanted range, but there's only one problem, it doesn't send no pictures. Thing is that User A has range where he writes some data, and pictures. He then emails this range with all data and pics to User B, and User B opens this sheet, so that he can read and see all the data and pics User A has send.... at this point, User B can only see text but no pics 'cuz code won't include them. Could you help with this?

    code
    Please Login or Register  to view this content.
    Last edited by Crüe; 08-10-2011 at 03:33 AM.

+ 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