+ Reply to Thread
Results 1 to 2 of 2

Need Help

  1. #1
    Registered User
    Join Date
    06-27-2012
    Location
    london, england
    MS-Off Ver
    Excel 2007
    Posts
    1

    Need Help

    Hi all,

    I`m Dave and i`m new to both this forum and Excel Programming. i have made some simple excel programmes before but need a lot of help on the next project!

    ill start from the top and hopefully it all makes sense.

    i currently putting together a new ordering system for the company i work for and need a macro to operate as follows:


    in the active worksheet:

    1) save a copy of the work sheet as a pdf and always in the same specified file location
    2) when saving the pdf file i would like it to be saved as what ever is entered into cell "B22"
    3) auto print a copy of the pdf to the default printer
    4) auto attach a copy of the pdf to an email (outlook)
    5) auto email subject to be the contents of cell "B22" plus Cell "C22" followed by order in brackets - (format example below)
    6) content of email to read "please see attached order"
    7) auto close excel without saving



    Cell B22 Contains the order number = P510001 (this is a manual input updated on every order)
    Cell C22 contains the job reference = Downs Road (this will be fixed)

    Example of Subject = P510001 - Downs Road (Order)



    Currently i have managed to find 2 different programme on the net that are similar to what i want:

    the first one:




    Sub Process()

    Dim WSName As String, CName As String, Directory As String, savename As String

    WSName = "Order"

    CName = "B22"

    Directory = "C:\Documents and Settings\dave\Desktop\Orders\"

    savename = Sheets(WSName).Range(CName).Text
    If Directory = "" Then Directory = CurDir & "\"

    On Error GoTo errorsub:
    ActiveWorkbook.SaveAs FileName:=Directory & savename & ".xls"
    Exit Sub

    errorsub:
    Beep
    MsgBox "Changes not saved!", vbExclamation, Title:=savename & ".xls"


    End Sub


    This saves a copy of the active work sheet in a specified location with the file name as what ever is in cell B22. the problem with this programme is it doesnt save as a pdf but only as an .xls........ being new to this i tried changing the parts that say .xls to .pdf and the process worked but the pdf documents wouldnt open they just through up an error message. not sure why it does this or how to fix it... maybe someone could explain.



    the second code i found was from the following link:

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

    i downloaded the trial excel document and the option to turn to pdf and mail worked well but its to complex for me to adapt. (The second Example 2)



    what i am trying to ask is there anyone, who doesn`t mind spending the time, that is able to adapt/combine the codes to make it work as the 7 steps i mentioned above???

    or am i asking way to much from someone?

    thanks

    Dave
    Last edited by benbow1987; 06-27-2012 at 09:10 AM. Reason: wrong web link

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Newbie - Big Help Wanted

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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