How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Ingo U Your Own Question

Ingo U
Ingo U, Software Engineer
Category: Programming
Satisfied Customers: 754
Experience:  Over 25 years experience in software development. Expert in Microsoft .Net, C#, C++, VB, SQL
Type Your Programming Question Here...
Ingo U is online now
A new question is answered every 9 seconds

I'm struggeling to print, save and mail this saved(PDF) as

Customer Question

I'm struggeling to print, save and mail this saved(PDF) as attachement.
JA: Sometimes things that you think will be really complicated end up being easy to fix. The Programmer I'm going to connect you with knows all the tricks and shortcuts. Tell me a bit more about what's going on so he can help you best.
Customer: So far i have:
JA: Is there anything else the Programmer should be aware of?
Customer: Sub Afsluiten()
' Afsluiten Macro
' Opslaan van deze factuur en daarna Print en Mail
' Sneltoets: Ctrl+a
Selection.PrintOut Copies:=1, Collate:=True
Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\@Walinga\" & Range("F9").Value & ".pdf", Quality:=xlQualityMinimum, IncludeDocProperties:=True, OpenAfterPublish:=False
Dim strRecipient As String: strRecipient = Range("I13").Value
Dim strSubject As String: strSubject = "Uw factuur van Onderhoudsbedrijf Walinga"
Dim booReturnReceipt As Boolean: booReturnReceipt = True
Application.Dialogs(xlDialogSendMail).Show Arg1:=strRecipient, Arg2:=strSubject, Arg3:=booReturnReceipt
'End Sub
JA: OK. Got it. I'm sending you to a secure page on JustAnswer so you can place the $5 fully-refundable deposit now. While you're filling out that form, I'll tell the Programmer about your situation and then connect you two.
Submitted: 6 months ago.
Category: Programming
Customer: replied 6 months ago.
Remember: I like to mail the worksheet in PDF
Customer: replied 6 months ago.
Range("F9") is a fiels in the worksheet with a date code: yyyymmddxx xx=sequential number (if more invoices per day) I have it covered in the ecel sheet!
Expert:  Martin replied 6 months ago.
Hello and welcome.Sorry to hear you're having trouble with your computer.What happens when you try to mail the PDF, do you get any errors?Please reply using the box below.Regards,Martin
Customer: replied 6 months ago.
The worksheet is printed correctly
The Worksheet is saved correctly with the correct name
The send part works fine, however outlook shows the worksheet in excel as an attachment. I can't get it working that its sent in PDF
Expert:  Martin replied 6 months ago.
If it's showing the worksheet in excel as an attachment it might not be in PDF format.Would you like me to connect to you remotely and have a look?
Customer: replied 6 months ago.
I hope you were able to suggest me how to program this excel Macro I just sent you.
Expert:  Martin replied 6 months ago.
Ahh ok, if it's the Excel macro code you're after I'll opt out and allow another expert to have a shot at it
Expert:  Ingo U replied 6 months ago.
Hi, It sounds like what you're trying to do is not what Application.Dialogs(xlDialogSendMail) is intended for - it's defined purpose is the send the current workbook as an email attachment, nothing else. What you'll probably want to do is use the Outlook API from Excel/VBA to send your PDF as an attachment. A general VBA code stub for this might look like this:Sub sendOutlookEmail()Dim outlook As ObjectDim outlookMail As ObjectSet outlook = CreateObject("Outlook.Application")Set outlookMail = outlook.CreateItem(0)With outlookMail.To = "*****@******.***".CC = "*****@******.***".BCC = "*****@******.***".Subject = "A Subject".Body = "A body".Attachments.Add "C:\@Walinga\" & Range("F9").Value & ".pdf".DisplayEnd WithEnd SubYou get the idea... Of course this all assumes that you have Outlook configured as a mail program on your computer...Hope that helps!-Ingo
Customer: replied 6 months ago.
What happens when I do not have outlook?
Expert:  Ingo U replied 6 months ago.
It becomes a bit more involved and may depend on your version of windows a bit;here's a possibility you can try: to be from a fellow countryman of yours, too!)
Customer: replied 6 months ago.
I guess I can manage it from here.
Expert:  Ingo U replied 6 months ago.
OK, please let me know if I can be of further assistance
Expert:  Ingo U replied 6 months ago.
Hi,just following up, were you able to use my solution? Please feel free to post any additional questions, comments or concerns you may have regarding this issue.If you're not yet satisfied with the result, please let me know what is missing. I will do my best to make it right for you.Otherwise, please don't forget to rate my service - I don't get paid for my work until your rating is received.Regards,Ingo U

Related Programming Questions