PDF images (1 Viewer)

Cronk

Registered User.
Local time
Today, 21:44
Joined
Jul 4, 2013
Messages
2,772
Does your code compile? Does it run without error? Step through it line by line.

Also to make the Outlook instance visible, add the line
Code:
appOutLook.visible = true
after creating appOutlook
 

kitty77

Registered User.
Local time
Today, 07:44
Joined
May 27, 2019
Messages
712
This what I have now. Still, nothing happens. Outlook does not come up...

Private Sub Command93_Click()
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
DoCmd.OutputTo acOutputReport, , acFormatPDF, "C:\aaa\" & [Msampleid] & ".pdf"
MsgBox "PDF Saved To Safe Air Systems As " & [Msampleid] & ".pdf"
Me.Caption = Me.Msampleid
With MailOutLook
.To = "test@test.com"
' .cc = ""
' .bcc = ""
.Attachments.Add "c:\aaa\9890.pdf"
.Subject = "Test"
.HTMLBody = "Test HL: <a href='folder path here'>Link description here</a>"
' .Send
End With
End Sub
 

kitty77

Registered User.
Local time
Today, 07:44
Joined
May 27, 2019
Messages
712
Got it to work. How can I make Outlook popup without sending automatically. This sent it without me seeing the Outlook dialog.
 

June7

AWF VIP
Local time
Today, 03:44
Joined
Mar 9, 2014
Messages
5,470
.Send is commented so it should not send automatically.
 

Micron

AWF VIP
Local time
Today, 07:44
Joined
Oct 20, 2018
Messages
3,478
Try .Display instead of .Send
I'm presuming when you say fixed it, your code in post 22 no longer applies.
 

kitty77

Registered User.
Local time
Today, 07:44
Joined
May 27, 2019
Messages
712
Ok, when .send is uncommented, it sends automatically. When it is commented ' .send, nothing happens or pops up.
 

June7

AWF VIP
Local time
Today, 03:44
Joined
Mar 9, 2014
Messages
5,470
Ooops, my bad. I left that line out of example in other thread. Just edited to add. Glad you got it working.
 

kitty77

Registered User.
Local time
Today, 07:44
Joined
May 27, 2019
Messages
712
Thanks! Going to do a little tweaking now. Wish me luck.
 

kitty77

Registered User.
Local time
Today, 07:44
Joined
May 27, 2019
Messages
712
How do I make .HTMLBody = "Test HL: <a href='folder path here'>Link description here</a>
multiple lines in the body. Meaning, how can I create more than one line? Not sure of the format.

Thanks...
 

Cronk

Registered User.
Local time
Today, 21:44
Joined
Jul 4, 2013
Messages
2,772
Code:
.HTMLBody = "Test HL: <a href='folder path here'>Link description here</a>" & _
    "<br>Second line" & _
    "<br>Third line"

or
Code:
dim strHTML as string
strHTML = "Test HL: <a href='folder path here'>Link description here</a>"
strHTML = strHTML & "<br>Second line"
strHTML = strHTML & "<br>Third line"
 

June7

AWF VIP
Local time
Today, 03:44
Joined
Mar 9, 2014
Messages
5,470
HTMLBody allows using HTML code tags to apply special formatting (underscore, bold, color, font) to text as well as the clickable URL link. If you just want simple text:

.Body = "My text here" & vbCrLf & "more text" & vbCrLf & "and more text"
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 12:44
Joined
Sep 12, 2006
Messages
15,652
I am not sure if this has been touched on. When access produces a pdf, it uses the current default printer. It's worth checking that the default printer makes sense. Try a different printer, and see if it uses a different font.

At the very least, try the "MicroSoft print to PDF", and see if that works.

You would need to (effectively) set the current printer to ""MicroSoft print to PDF" to prepare the pdf, then set the current printer back to nothing after producing the pdf, which actually just restores the active printer to the default.
 
Last edited:

zeroaccess

Active member
Local time
Today, 06:44
Joined
Jan 30, 2020
Messages
671
No printer is used when SendObject or OutputTo PDF is used. That wouldn't make sense. It is no different than choosing Save As in MS Word and saving as type .PDF.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 06:44
Joined
Feb 28, 2001
Messages
27,172
@zeroaccess - are you certain that OutputTo PDF doesn't look at the printer? As an experiment, try changing the selected printer before doing that. In the past that HAS been shown to have an effect. If the latest version of Access has fixed that, all I can say is "Hooray!" because it has vexed many folks for years.
 

zeroaccess

Active member
Local time
Today, 06:44
Joined
Jan 30, 2020
Messages
671
@zeroaccess - are you certain that OutputTo PDF doesn't look at the printer? As an experiment, try changing the selected printer before doing that. In the past that HAS been shown to have an effect. If the latest version of Access has fixed that, all I can say is "Hooray!" because it has vexed many folks for years.
What would I notice if it did? Would I get an error?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 06:44
Joined
Feb 28, 2001
Messages
27,172
Difference in resolution of the images.
 

zeroaccess

Active member
Local time
Today, 06:44
Joined
Jan 30, 2020
Messages
671
Ok. What other printer should I change to to test this? A real printer, or a software "printer"?

Also, it needs to be noted that I have shown that the Output Quality setting of DoCmd.OutputTo exactly mirrors the effect of saving a .PDF with the "High Quality" (acExportQualityPrint) vs "E-Mail" (acExportQualityScreen) presets when doing a Save As in Word or Excel. And, the output of acExportQualityScreen is identical to what you get when using DoCmd.SendObject.

In other words:
SQL:
    DoCmd.OutputTo , , acFormatPDF, , , , , acExportQualityPrint
Is the same as Saving As a High Quality PDF from other Office Suite applications. And,

SQL:
    DoCmd.OutputTo , , acFormatPDF, , , , , acExportQualityScreen
    DoCmd.SendObject , , acFormatPDF
Give the same output as an Email quality PDF from other Office Suite applications.
 
Last edited:

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 06:44
Joined
Feb 28, 2001
Messages
27,172
If you are satisfied that a high-quality export works, then it is obvious that what used to be a really ugly situation has been addressed. In that case it becomes immaterial. I can only tell you that back in the AC97 days, this was a problem. But back then, I don't recall "acFormatPDF" was available either. So if you don't feel the need to test, I don't either.
 

Users who are viewing this thread

Top Bottom