Hyperlink for email

G

Guest

Hi Again,

I use the code below to email reports. I have the report Decontamination
Guidelines set up in Access. I needed something other than Snapshot reports,
as not everyone had or was willing to use Snapshot viewer. Did some research
and found valuable help at this site on the Cute PDF writer and setting
application printers. Worked great until boss wanted something different.
Decided we needed something more illiustrated. Set up Powerpoint
presentation and saved as a pdf file.

Now the problem I have (and I so hope someone will have an idea to make it
work) is that the pdf file is outside my database and I would very much like
to still click my command button and have all reports, including the pdf file
outside the db, show up on the email message as attachments automatically.

If someone has a solution, I would very much appreciate it.
Thanks in advance,
Pam

Private Sub CommandEmailRMA_Click()
On Error GoTo Err_CommandEmailRMA_Click
Me.Refresh

If Me.PumpType = "SCMP" Then
Set Application.Printer = Application.Printers("CutePDF Writer")
DoCmd.OpenReport "rRMAPage1", , , "JobNumber=" &
[Forms]![f*GeneralInformationWITHQUOTE]![JobNumber]
DoCmd.OpenReport "rScmpDecontaminationGuidelines"
Set Application.Printer = Nothing
Else
Set Application.Printer = Application.Printers("CutePDF Writer")
DoCmd.OpenReport "rRMAPage1", , , "JobNumber=" &
[Forms]![f*GeneralInformationWITHQUOTE]![JobNumber]
Set Application.Printer = Nothing

End If

Exit_CommandEmailRMA_Click:
Exit Sub

Err_CommandEmailRMA_Click:
MsgBox Err.Description
Resume Exit_CommandEmailRMA_Click

End Sub
 
G

Guest

Let me know if this helps:

Sub EmailPDF()

Dim outApp As Outlook.Application, outMsg As MailItem
Set outApp = CreateObject("Outlook.Application")
Set outMsg = outApp.CreateItem(olMailItem)

strEmail = "(e-mail address removed)"
strCC = "(e-mail address removed)"
strBCC = "(e-mail address removed)"

strSubject = "My PDF"

strPhoto = strMyPath & strMyPDF

strMsg = "Here's your PDF"

With outMsg
.Importance = olImportanceHigh
.To = strEmail
.CC = strCC
.BCC = strBCC
.Subject = strSubject
.Body = strMsg
If IsNull(Me.PhotoFileName) Then
Else
.Attachments.Add strPhoto
End If
.Display
.Send
End With

Set outApp = Nothing
Set outMsg = Nothing

End Sub
 
G

Guest

Let me know if this helps

Sub EmailPDF()

Dim outApp As Outlook.Application, outMsg As MailItem
Set outApp = CreateObject("Outlook.Application")
Set outMsg = outApp.CreateItem(olMailItem)

strEmail = "(e-mail address removed)"
strCC = "(e-mail address removed)"
strBCC = "(e-mail address removed)"

strSubject = "My PDF"

strPhoto = strMyPath & strMyPDF

strMsg = "Here's your PDF"

With outMsg
.Importance = olImportanceHigh
.To = strEmail
.CC = strCC
.BCC = strBCC
.Subject = strSubject
.Body = strMsg
If IsNull(Me.PhotoFileName) Then
Else
.Attachments.Add strPhoto
End If
.Display
.Send
End With

Set outApp = Nothing
Set outMsg = Nothing

End Sub
 
G

Guest

Thank you for the reply. I don't think my first message may have been clear.
The code I use takes the reports I have in Access and uses the Cute Pdf
Writer to convert them from snapshot to pdf's and then I save them from
dialog box that pops up to a file that I use to store all documents in that I
want to email. I have a command button to click to take me to this file and
then select all and email.

I was hoping there would be some way to select this pdf file that is outside
the database and pull it into this temp file with the other Access reports
that are saved as pdf's. I may be asking for too much, but thought it worth
a try anyway.
If you have any other suggestions, I would appreciate hearing from you.
Thanks,
Pam

Access101 said:
Let me know if this helps

Sub EmailPDF()

Dim outApp As Outlook.Application, outMsg As MailItem
Set outApp = CreateObject("Outlook.Application")
Set outMsg = outApp.CreateItem(olMailItem)

strEmail = "(e-mail address removed)"
strCC = "(e-mail address removed)"
strBCC = "(e-mail address removed)"

strSubject = "My PDF"

strPhoto = strMyPath & strMyPDF

strMsg = "Here's your PDF"

With outMsg
.Importance = olImportanceHigh
.To = strEmail
.CC = strCC
.BCC = strBCC
.Subject = strSubject
.Body = strMsg
If IsNull(Me.PhotoFileName) Then
Else
.Attachments.Add strPhoto
End If
.Display
.Send
End With

Set outApp = Nothing
Set outMsg = Nothing

End Sub


PHisaw said:
Hi Again,

I use the code below to email reports. I have the report Decontamination
Guidelines set up in Access. I needed something other than Snapshot reports,
as not everyone had or was willing to use Snapshot viewer. Did some research
and found valuable help at this site on the Cute PDF writer and setting
application printers. Worked great until boss wanted something different.
Decided we needed something more illiustrated. Set up Powerpoint
presentation and saved as a pdf file.

Now the problem I have (and I so hope someone will have an idea to make it
work) is that the pdf file is outside my database and I would very much like
to still click my command button and have all reports, including the pdf file
outside the db, show up on the email message as attachments automatically.

If someone has a solution, I would very much appreciate it.
Thanks in advance,
Pam

Private Sub CommandEmailRMA_Click()
On Error GoTo Err_CommandEmailRMA_Click
Me.Refresh

If Me.PumpType = "SCMP" Then
Set Application.Printer = Application.Printers("CutePDF Writer")
DoCmd.OpenReport "rRMAPage1", , , "JobNumber=" &
[Forms]![f*GeneralInformationWITHQUOTE]![JobNumber]
DoCmd.OpenReport "rScmpDecontaminationGuidelines"
Set Application.Printer = Nothing
Else
Set Application.Printer = Application.Printers("CutePDF Writer")
DoCmd.OpenReport "rRMAPage1", , , "JobNumber=" &
[Forms]![f*GeneralInformationWITHQUOTE]![JobNumber]
Set Application.Printer = Nothing

End If

Exit_CommandEmailRMA_Click:
Exit Sub

Err_CommandEmailRMA_Click:
MsgBox Err.Description
Resume Exit_CommandEmailRMA_Click

End Sub
 
G

Guest

I may not have read your question correctly either ... easy to do when I'm in
a rush.

I'm now thinking you have something like this:

C:\AcRptSavedbyCute Pdf_1.pdf
C:\AcRptSavedbyCute Pdf_2.pdf
C:\AcRptSavedOutSideAccess_1.pdf

strFile(0) = "C:\AcRptSavedbyCute Pdf_1.pdf"
strFile(1) ="C:\AcRptSavedbyCute Pdf_2.pdf"
strFile(2) = "C:\AcRptSavedOutSideAccess_1.pdf"

If this is the case, you could just repeat the "Attachment" line of code

For i = 1 to CountFilesInMyHoldingTankTmpDir
.Attachments.Add strFile(i)
next i

Let me know if this helps.

PHisaw said:
Thank you for the reply. I don't think my first message may have been clear.
The code I use takes the reports I have in Access and uses the Cute Pdf
Writer to convert them from snapshot to pdf's and then I save them from
dialog box that pops up to a file that I use to store all documents in that I
want to email. I have a command button to click to take me to this file and
then select all and email.

I was hoping there would be some way to select this pdf file that is outside
the database and pull it into this temp file with the other Access reports
that are saved as pdf's. I may be asking for too much, but thought it worth
a try anyway.
If you have any other suggestions, I would appreciate hearing from you.
Thanks,
Pam

Access101 said:
Let me know if this helps

Sub EmailPDF()

Dim outApp As Outlook.Application, outMsg As MailItem
Set outApp = CreateObject("Outlook.Application")
Set outMsg = outApp.CreateItem(olMailItem)

strEmail = "(e-mail address removed)"
strCC = "(e-mail address removed)"
strBCC = "(e-mail address removed)"

strSubject = "My PDF"

strPhoto = strMyPath & strMyPDF

strMsg = "Here's your PDF"

With outMsg
.Importance = olImportanceHigh
.To = strEmail
.CC = strCC
.BCC = strBCC
.Subject = strSubject
.Body = strMsg
If IsNull(Me.PhotoFileName) Then
Else
.Attachments.Add strPhoto
End If
.Display
.Send
End With

Set outApp = Nothing
Set outMsg = Nothing

End Sub


PHisaw said:
Hi Again,

I use the code below to email reports. I have the report Decontamination
Guidelines set up in Access. I needed something other than Snapshot reports,
as not everyone had or was willing to use Snapshot viewer. Did some research
and found valuable help at this site on the Cute PDF writer and setting
application printers. Worked great until boss wanted something different.
Decided we needed something more illiustrated. Set up Powerpoint
presentation and saved as a pdf file.

Now the problem I have (and I so hope someone will have an idea to make it
work) is that the pdf file is outside my database and I would very much like
to still click my command button and have all reports, including the pdf file
outside the db, show up on the email message as attachments automatically.

If someone has a solution, I would very much appreciate it.
Thanks in advance,
Pam

Private Sub CommandEmailRMA_Click()
On Error GoTo Err_CommandEmailRMA_Click
Me.Refresh

If Me.PumpType = "SCMP" Then
Set Application.Printer = Application.Printers("CutePDF Writer")
DoCmd.OpenReport "rRMAPage1", , , "JobNumber=" &
[Forms]![f*GeneralInformationWITHQUOTE]![JobNumber]
DoCmd.OpenReport "rScmpDecontaminationGuidelines"
Set Application.Printer = Nothing
Else
Set Application.Printer = Application.Printers("CutePDF Writer")
DoCmd.OpenReport "rRMAPage1", , , "JobNumber=" &
[Forms]![f*GeneralInformationWITHQUOTE]![JobNumber]
Set Application.Printer = Nothing

End If

Exit_CommandEmailRMA_Click:
Exit Sub

Err_CommandEmailRMA_Click:
MsgBox Err.Description
Resume Exit_CommandEmailRMA_Click

End Sub
 
G

Guest

I'm sorry - I think I'm really confused now!! Do I put all of this code in
the OnClick event of the command button? Not sure what you mean by repeat
"Attachment" line of code.

Access101 said:
I may not have read your question correctly either ... easy to do when I'm in
a rush.

I'm now thinking you have something like this:

C:\AcRptSavedbyCute Pdf_1.pdf
C:\AcRptSavedbyCute Pdf_2.pdf
C:\AcRptSavedOutSideAccess_1.pdf

strFile(0) = "C:\AcRptSavedbyCute Pdf_1.pdf"
strFile(1) ="C:\AcRptSavedbyCute Pdf_2.pdf"
strFile(2) = "C:\AcRptSavedOutSideAccess_1.pdf"

If this is the case, you could just repeat the "Attachment" line of code

For i = 1 to CountFilesInMyHoldingTankTmpDir
.Attachments.Add strFile(i)
next i

Let me know if this helps.

PHisaw said:
Thank you for the reply. I don't think my first message may have been clear.
The code I use takes the reports I have in Access and uses the Cute Pdf
Writer to convert them from snapshot to pdf's and then I save them from
dialog box that pops up to a file that I use to store all documents in that I
want to email. I have a command button to click to take me to this file and
then select all and email.

I was hoping there would be some way to select this pdf file that is outside
the database and pull it into this temp file with the other Access reports
that are saved as pdf's. I may be asking for too much, but thought it worth
a try anyway.
If you have any other suggestions, I would appreciate hearing from you.
Thanks,
Pam

Access101 said:
Let me know if this helps

Sub EmailPDF()

Dim outApp As Outlook.Application, outMsg As MailItem
Set outApp = CreateObject("Outlook.Application")
Set outMsg = outApp.CreateItem(olMailItem)

strEmail = "(e-mail address removed)"
strCC = "(e-mail address removed)"
strBCC = "(e-mail address removed)"

strSubject = "My PDF"

strPhoto = strMyPath & strMyPDF

strMsg = "Here's your PDF"

With outMsg
.Importance = olImportanceHigh
.To = strEmail
.CC = strCC
.BCC = strBCC
.Subject = strSubject
.Body = strMsg
If IsNull(Me.PhotoFileName) Then
Else
.Attachments.Add strPhoto
End If
.Display
.Send
End With

Set outApp = Nothing
Set outMsg = Nothing

End Sub


:

Hi Again,

I use the code below to email reports. I have the report Decontamination
Guidelines set up in Access. I needed something other than Snapshot reports,
as not everyone had or was willing to use Snapshot viewer. Did some research
and found valuable help at this site on the Cute PDF writer and setting
application printers. Worked great until boss wanted something different.
Decided we needed something more illiustrated. Set up Powerpoint
presentation and saved as a pdf file.

Now the problem I have (and I so hope someone will have an idea to make it
work) is that the pdf file is outside my database and I would very much like
to still click my command button and have all reports, including the pdf file
outside the db, show up on the email message as attachments automatically.

If someone has a solution, I would very much appreciate it.
Thanks in advance,
Pam

Private Sub CommandEmailRMA_Click()
On Error GoTo Err_CommandEmailRMA_Click
Me.Refresh

If Me.PumpType = "SCMP" Then
Set Application.Printer = Application.Printers("CutePDF Writer")
DoCmd.OpenReport "rRMAPage1", , , "JobNumber=" &
[Forms]![f*GeneralInformationWITHQUOTE]![JobNumber]
DoCmd.OpenReport "rScmpDecontaminationGuidelines"
Set Application.Printer = Nothing
Else
Set Application.Printer = Application.Printers("CutePDF Writer")
DoCmd.OpenReport "rRMAPage1", , , "JobNumber=" &
[Forms]![f*GeneralInformationWITHQUOTE]![JobNumber]
Set Application.Printer = Nothing

End If

Exit_CommandEmailRMA_Click:
Exit Sub

Err_CommandEmailRMA_Click:
MsgBox Err.Description
Resume Exit_CommandEmailRMA_Click

End Sub
 
G

Guest

Sorry, this was a fill in for code I'd given you previously:

Instead of this, which would only attach one file (see previous email for
full code):

With outMsg
.To = strEmail
.Subject = strSubject
.Body = strMsg
.Attachments.Add strPhoto
.Send
End With

You could do this:

With outMsg
.To = strEmail
For i = 1 to CountFilesInMyHoldingTankTmpDir
.Attachments.Add strFile(i)
next i
.Send
End With

Then you would be able to attach all the files you wanted, not only the ones
created by Cute PDF, but also the stray PDF file created outside of Access.




PHisaw said:
I'm sorry - I think I'm really confused now!! Do I put all of this code in
the OnClick event of the command button? Not sure what you mean by repeat
"Attachment" line of code.

Access101 said:
I may not have read your question correctly either ... easy to do when I'm in
a rush.

I'm now thinking you have something like this:

C:\AcRptSavedbyCute Pdf_1.pdf
C:\AcRptSavedbyCute Pdf_2.pdf
C:\AcRptSavedOutSideAccess_1.pdf

strFile(0) = "C:\AcRptSavedbyCute Pdf_1.pdf"
strFile(1) ="C:\AcRptSavedbyCute Pdf_2.pdf"
strFile(2) = "C:\AcRptSavedOutSideAccess_1.pdf"

If this is the case, you could just repeat the "Attachment" line of code

For i = 1 to CountFilesInMyHoldingTankTmpDir
.Attachments.Add strFile(i)
next i

Let me know if this helps.

PHisaw said:
Thank you for the reply. I don't think my first message may have been clear.
The code I use takes the reports I have in Access and uses the Cute Pdf
Writer to convert them from snapshot to pdf's and then I save them from
dialog box that pops up to a file that I use to store all documents in that I
want to email. I have a command button to click to take me to this file and
then select all and email.

I was hoping there would be some way to select this pdf file that is outside
the database and pull it into this temp file with the other Access reports
that are saved as pdf's. I may be asking for too much, but thought it worth
a try anyway.
If you have any other suggestions, I would appreciate hearing from you.
Thanks,
Pam

:

Let me know if this helps

Sub EmailPDF()

Dim outApp As Outlook.Application, outMsg As MailItem
Set outApp = CreateObject("Outlook.Application")
Set outMsg = outApp.CreateItem(olMailItem)

strEmail = "(e-mail address removed)"
strCC = "(e-mail address removed)"
strBCC = "(e-mail address removed)"

strSubject = "My PDF"

strPhoto = strMyPath & strMyPDF

strMsg = "Here's your PDF"

With outMsg
.Importance = olImportanceHigh
.To = strEmail
.CC = strCC
.BCC = strBCC
.Subject = strSubject
.Body = strMsg
If IsNull(Me.PhotoFileName) Then
Else
.Attachments.Add strPhoto
End If
.Display
.Send
End With

Set outApp = Nothing
Set outMsg = Nothing

End Sub


:

Hi Again,

I use the code below to email reports. I have the report Decontamination
Guidelines set up in Access. I needed something other than Snapshot reports,
as not everyone had or was willing to use Snapshot viewer. Did some research
and found valuable help at this site on the Cute PDF writer and setting
application printers. Worked great until boss wanted something different.
Decided we needed something more illiustrated. Set up Powerpoint
presentation and saved as a pdf file.

Now the problem I have (and I so hope someone will have an idea to make it
work) is that the pdf file is outside my database and I would very much like
to still click my command button and have all reports, including the pdf file
outside the db, show up on the email message as attachments automatically.

If someone has a solution, I would very much appreciate it.
Thanks in advance,
Pam

Private Sub CommandEmailRMA_Click()
On Error GoTo Err_CommandEmailRMA_Click
Me.Refresh

If Me.PumpType = "SCMP" Then
Set Application.Printer = Application.Printers("CutePDF Writer")
DoCmd.OpenReport "rRMAPage1", , , "JobNumber=" &
[Forms]![f*GeneralInformationWITHQUOTE]![JobNumber]
DoCmd.OpenReport "rScmpDecontaminationGuidelines"
Set Application.Printer = Nothing
Else
Set Application.Printer = Application.Printers("CutePDF Writer")
DoCmd.OpenReport "rRMAPage1", , , "JobNumber=" &
[Forms]![f*GeneralInformationWITHQUOTE]![JobNumber]
Set Application.Printer = Nothing

End If

Exit_CommandEmailRMA_Click:
Exit Sub

Err_CommandEmailRMA_Click:
MsgBox Err.Description
Resume Exit_CommandEmailRMA_Click

End Sub
 
G

Guest

I'm sorry for the bother, but I'm still not clear on this. Do I put this in
the OnClick event for the command button? Where do I put in the report names
I want to save or select? Can you please explain how it works?
Thanks again for your time and help.
Pam


Access101 said:
Sorry, this was a fill in for code I'd given you previously:

Instead of this, which would only attach one file (see previous email for
full code):

With outMsg
.To = strEmail
.Subject = strSubject
.Body = strMsg
.Attachments.Add strPhoto
.Send
End With

You could do this:

With outMsg
.To = strEmail
For i = 1 to CountFilesInMyHoldingTankTmpDir
.Attachments.Add strFile(i)
next i
.Send
End With

Then you would be able to attach all the files you wanted, not only the ones
created by Cute PDF, but also the stray PDF file created outside of Access.




PHisaw said:
I'm sorry - I think I'm really confused now!! Do I put all of this code in
the OnClick event of the command button? Not sure what you mean by repeat
"Attachment" line of code.

Access101 said:
I may not have read your question correctly either ... easy to do when I'm in
a rush.

I'm now thinking you have something like this:

C:\AcRptSavedbyCute Pdf_1.pdf
C:\AcRptSavedbyCute Pdf_2.pdf
C:\AcRptSavedOutSideAccess_1.pdf

strFile(0) = "C:\AcRptSavedbyCute Pdf_1.pdf"
strFile(1) ="C:\AcRptSavedbyCute Pdf_2.pdf"
strFile(2) = "C:\AcRptSavedOutSideAccess_1.pdf"

If this is the case, you could just repeat the "Attachment" line of code

For i = 1 to CountFilesInMyHoldingTankTmpDir
.Attachments.Add strFile(i)
next i

Let me know if this helps.

:

Thank you for the reply. I don't think my first message may have been clear.
The code I use takes the reports I have in Access and uses the Cute Pdf
Writer to convert them from snapshot to pdf's and then I save them from
dialog box that pops up to a file that I use to store all documents in that I
want to email. I have a command button to click to take me to this file and
then select all and email.

I was hoping there would be some way to select this pdf file that is outside
the database and pull it into this temp file with the other Access reports
that are saved as pdf's. I may be asking for too much, but thought it worth
a try anyway.
If you have any other suggestions, I would appreciate hearing from you.
Thanks,
Pam

:

Let me know if this helps

Sub EmailPDF()

Dim outApp As Outlook.Application, outMsg As MailItem
Set outApp = CreateObject("Outlook.Application")
Set outMsg = outApp.CreateItem(olMailItem)

strEmail = "(e-mail address removed)"
strCC = "(e-mail address removed)"
strBCC = "(e-mail address removed)"

strSubject = "My PDF"

strPhoto = strMyPath & strMyPDF

strMsg = "Here's your PDF"

With outMsg
.Importance = olImportanceHigh
.To = strEmail
.CC = strCC
.BCC = strBCC
.Subject = strSubject
.Body = strMsg
If IsNull(Me.PhotoFileName) Then
Else
.Attachments.Add strPhoto
End If
.Display
.Send
End With

Set outApp = Nothing
Set outMsg = Nothing

End Sub


:

Hi Again,

I use the code below to email reports. I have the report Decontamination
Guidelines set up in Access. I needed something other than Snapshot reports,
as not everyone had or was willing to use Snapshot viewer. Did some research
and found valuable help at this site on the Cute PDF writer and setting
application printers. Worked great until boss wanted something different.
Decided we needed something more illiustrated. Set up Powerpoint
presentation and saved as a pdf file.

Now the problem I have (and I so hope someone will have an idea to make it
work) is that the pdf file is outside my database and I would very much like
to still click my command button and have all reports, including the pdf file
outside the db, show up on the email message as attachments automatically.

If someone has a solution, I would very much appreciate it.
Thanks in advance,
Pam

Private Sub CommandEmailRMA_Click()
On Error GoTo Err_CommandEmailRMA_Click
Me.Refresh

If Me.PumpType = "SCMP" Then
Set Application.Printer = Application.Printers("CutePDF Writer")
DoCmd.OpenReport "rRMAPage1", , , "JobNumber=" &
[Forms]![f*GeneralInformationWITHQUOTE]![JobNumber]
DoCmd.OpenReport "rScmpDecontaminationGuidelines"
Set Application.Printer = Nothing
Else
Set Application.Printer = Application.Printers("CutePDF Writer")
DoCmd.OpenReport "rRMAPage1", , , "JobNumber=" &
[Forms]![f*GeneralInformationWITHQUOTE]![JobNumber]
Set Application.Printer = Nothing

End If

Exit_CommandEmailRMA_Click:
Exit Sub

Err_CommandEmailRMA_Click:
MsgBox Err.Description
Resume Exit_CommandEmailRMA_Click

End Sub
 
G

Guest

Dim strFile(10)
tmp = Dir("C:\PathToPDF's\*.pdf)
While tmp <> ""
strFile(i) = tmp
i=i + 1
CountFilesInMyHoldingTankTmpDir = i
tmp = Dir()
Wend

The code above, takes the PDF files from your directory, and stores them in
an array called: strFile()

strFile(0) is your first PDF file from the directory
strFile(2) is your second PDF file from the directory

Now that you have read them into the array, you want to use the code below
to attach each one of them into email, right?

So that's where this code comes in (although it is embedded in the code I
originally sent you that is 20 lines long, these three lines are like lines
14, 15, & 16 or something like that, remember?

For i = 0 to CountFilesInMyHoldingTankTmpDir
.Attachments.Add strFile(i)
next i

And the CountFilesInMyHoldingTankTmpDir is the value from above where I
stated that CountFilesInMyHoldingTankTmpDir = i

Because i was how many files were read from your directory.

Is this getting any better?
PHisaw said:
I'm sorry for the bother, but I'm still not clear on this. Do I put this in
the OnClick event for the command button? Where do I put in the report names
I want to save or select? Can you please explain how it works?
Thanks again for your time and help.
Pam


Access101 said:
Sorry, this was a fill in for code I'd given you previously:

Instead of this, which would only attach one file (see previous email for
full code):

With outMsg
.To = strEmail
.Subject = strSubject
.Body = strMsg
.Attachments.Add strPhoto
.Send
End With

You could do this:

With outMsg
.To = strEmail
For i = 1 to CountFilesInMyHoldingTankTmpDir
.Attachments.Add strFile(i)
next i
.Send
End With

Then you would be able to attach all the files you wanted, not only the ones
created by Cute PDF, but also the stray PDF file created outside of Access.




PHisaw said:
I'm sorry - I think I'm really confused now!! Do I put all of this code in
the OnClick event of the command button? Not sure what you mean by repeat
"Attachment" line of code.

:

I may not have read your question correctly either ... easy to do when I'm in
a rush.

I'm now thinking you have something like this:

C:\AcRptSavedbyCute Pdf_1.pdf
C:\AcRptSavedbyCute Pdf_2.pdf
C:\AcRptSavedOutSideAccess_1.pdf

strFile(0) = "C:\AcRptSavedbyCute Pdf_1.pdf"
strFile(1) ="C:\AcRptSavedbyCute Pdf_2.pdf"
strFile(2) = "C:\AcRptSavedOutSideAccess_1.pdf"

If this is the case, you could just repeat the "Attachment" line of code

For i = 1 to CountFilesInMyHoldingTankTmpDir
.Attachments.Add strFile(i)
next i

Let me know if this helps.

:

Thank you for the reply. I don't think my first message may have been clear.
The code I use takes the reports I have in Access and uses the Cute Pdf
Writer to convert them from snapshot to pdf's and then I save them from
dialog box that pops up to a file that I use to store all documents in that I
want to email. I have a command button to click to take me to this file and
then select all and email.

I was hoping there would be some way to select this pdf file that is outside
the database and pull it into this temp file with the other Access reports
that are saved as pdf's. I may be asking for too much, but thought it worth
a try anyway.
If you have any other suggestions, I would appreciate hearing from you.
Thanks,
Pam

:

Let me know if this helps

Sub EmailPDF()

Dim outApp As Outlook.Application, outMsg As MailItem
Set outApp = CreateObject("Outlook.Application")
Set outMsg = outApp.CreateItem(olMailItem)

strEmail = "(e-mail address removed)"
strCC = "(e-mail address removed)"
strBCC = "(e-mail address removed)"

strSubject = "My PDF"

strPhoto = strMyPath & strMyPDF

strMsg = "Here's your PDF"

With outMsg
.Importance = olImportanceHigh
.To = strEmail
.CC = strCC
.BCC = strBCC
.Subject = strSubject
.Body = strMsg
If IsNull(Me.PhotoFileName) Then
Else
.Attachments.Add strPhoto
End If
.Display
.Send
End With

Set outApp = Nothing
Set outMsg = Nothing

End Sub


:

Hi Again,

I use the code below to email reports. I have the report Decontamination
Guidelines set up in Access. I needed something other than Snapshot reports,
as not everyone had or was willing to use Snapshot viewer. Did some research
and found valuable help at this site on the Cute PDF writer and setting
application printers. Worked great until boss wanted something different.
Decided we needed something more illiustrated. Set up Powerpoint
presentation and saved as a pdf file.

Now the problem I have (and I so hope someone will have an idea to make it
work) is that the pdf file is outside my database and I would very much like
to still click my command button and have all reports, including the pdf file
outside the db, show up on the email message as attachments automatically.

If someone has a solution, I would very much appreciate it.
Thanks in advance,
Pam

Private Sub CommandEmailRMA_Click()
On Error GoTo Err_CommandEmailRMA_Click
Me.Refresh

If Me.PumpType = "SCMP" Then
Set Application.Printer = Application.Printers("CutePDF Writer")
DoCmd.OpenReport "rRMAPage1", , , "JobNumber=" &
[Forms]![f*GeneralInformationWITHQUOTE]![JobNumber]
DoCmd.OpenReport "rScmpDecontaminationGuidelines"
Set Application.Printer = Nothing
Else
Set Application.Printer = Application.Printers("CutePDF Writer")
DoCmd.OpenReport "rRMAPage1", , , "JobNumber=" &
[Forms]![f*GeneralInformationWITHQUOTE]![JobNumber]
Set Application.Printer = Nothing

End If

Exit_CommandEmailRMA_Click:
Exit Sub

Err_CommandEmailRMA_Click:
MsgBox Err.Description
Resume Exit_CommandEmailRMA_Click

End Sub
 
G

Guest

I think this is the whole thing. You just need to replace the path and a few
items:

Dim strFile(10) ‘assuming you have 11 or less files in the directory that
you are wanting to attach.
Dim tmp as string, i as integer, intFileCount as integer, strPath as string
Dim strEmail as string, strCC as string, strBCC as string, strSubject as
string, strMsg as string

Sub EmailPDF()

strPath = "C:\PathToPDF's\â€

tmp = Dir(strPath & “*.pdfâ€)
While tmp <> ""
strFile(i) = tmp
i=i + 1
intFileCount = i
tmp = Dir()
Wend

Dim outApp As Outlook.Application, outMsg As MailItem
Set outApp = CreateObject("Outlook.Application")
Set outMsg = outApp.CreateItem(olMailItem)

strEmail = "(e-mail address removed)"
strCC = "(e-mail address removed)"
strBCC = "(e-mail address removed)"
strSubject = "My PDF"
strMsg = "Here's your PDF"

With outMsg
.Importance = olImportanceHigh
.To = strEmail
.CC = strCC
.BCC = strBCC
.Subject = strSubject
.Body = strMsg
For i = 1 to intFileCount -1
.Attachments.Add strPath & strFile(i)
Next i
.Display
.Send
End With

Set outApp = Nothing
Set outMsg = Nothing

End Sub
 
G

Guest

Yes, you can put this on the OnClick event.

And it was my understanding that the "report names" were actually PDF files
that you had saved to a directory somewhere.

So you would edit the strPath I sent you in code, and put THAT directory
name in there.

With this method, you can only have the files that you want to send in that
particular email, in that directory. In other words, if you have 1,000 pdf
files in that dir, it will read all of them into the array (overloading it of
course, because it only allows 11 files to be read into it). But you get the
idea.

PHisaw said:
I'm sorry for the bother, but I'm still not clear on this. Do I put this in
the OnClick event for the command button? Where do I put in the report names
I want to save or select? Can you please explain how it works?
Thanks again for your time and help.
Pam


Access101 said:
Sorry, this was a fill in for code I'd given you previously:

Instead of this, which would only attach one file (see previous email for
full code):

With outMsg
.To = strEmail
.Subject = strSubject
.Body = strMsg
.Attachments.Add strPhoto
.Send
End With

You could do this:

With outMsg
.To = strEmail
For i = 1 to CountFilesInMyHoldingTankTmpDir
.Attachments.Add strFile(i)
next i
.Send
End With

Then you would be able to attach all the files you wanted, not only the ones
created by Cute PDF, but also the stray PDF file created outside of Access.




PHisaw said:
I'm sorry - I think I'm really confused now!! Do I put all of this code in
the OnClick event of the command button? Not sure what you mean by repeat
"Attachment" line of code.

:

I may not have read your question correctly either ... easy to do when I'm in
a rush.

I'm now thinking you have something like this:

C:\AcRptSavedbyCute Pdf_1.pdf
C:\AcRptSavedbyCute Pdf_2.pdf
C:\AcRptSavedOutSideAccess_1.pdf

strFile(0) = "C:\AcRptSavedbyCute Pdf_1.pdf"
strFile(1) ="C:\AcRptSavedbyCute Pdf_2.pdf"
strFile(2) = "C:\AcRptSavedOutSideAccess_1.pdf"

If this is the case, you could just repeat the "Attachment" line of code

For i = 1 to CountFilesInMyHoldingTankTmpDir
.Attachments.Add strFile(i)
next i

Let me know if this helps.

:

Thank you for the reply. I don't think my first message may have been clear.
The code I use takes the reports I have in Access and uses the Cute Pdf
Writer to convert them from snapshot to pdf's and then I save them from
dialog box that pops up to a file that I use to store all documents in that I
want to email. I have a command button to click to take me to this file and
then select all and email.

I was hoping there would be some way to select this pdf file that is outside
the database and pull it into this temp file with the other Access reports
that are saved as pdf's. I may be asking for too much, but thought it worth
a try anyway.
If you have any other suggestions, I would appreciate hearing from you.
Thanks,
Pam

:

Let me know if this helps

Sub EmailPDF()

Dim outApp As Outlook.Application, outMsg As MailItem
Set outApp = CreateObject("Outlook.Application")
Set outMsg = outApp.CreateItem(olMailItem)

strEmail = "(e-mail address removed)"
strCC = "(e-mail address removed)"
strBCC = "(e-mail address removed)"

strSubject = "My PDF"

strPhoto = strMyPath & strMyPDF

strMsg = "Here's your PDF"

With outMsg
.Importance = olImportanceHigh
.To = strEmail
.CC = strCC
.BCC = strBCC
.Subject = strSubject
.Body = strMsg
If IsNull(Me.PhotoFileName) Then
Else
.Attachments.Add strPhoto
End If
.Display
.Send
End With

Set outApp = Nothing
Set outMsg = Nothing

End Sub


:

Hi Again,

I use the code below to email reports. I have the report Decontamination
Guidelines set up in Access. I needed something other than Snapshot reports,
as not everyone had or was willing to use Snapshot viewer. Did some research
and found valuable help at this site on the Cute PDF writer and setting
application printers. Worked great until boss wanted something different.
Decided we needed something more illiustrated. Set up Powerpoint
presentation and saved as a pdf file.

Now the problem I have (and I so hope someone will have an idea to make it
work) is that the pdf file is outside my database and I would very much like
to still click my command button and have all reports, including the pdf file
outside the db, show up on the email message as attachments automatically.

If someone has a solution, I would very much appreciate it.
Thanks in advance,
Pam

Private Sub CommandEmailRMA_Click()
On Error GoTo Err_CommandEmailRMA_Click
Me.Refresh

If Me.PumpType = "SCMP" Then
Set Application.Printer = Application.Printers("CutePDF Writer")
DoCmd.OpenReport "rRMAPage1", , , "JobNumber=" &
[Forms]![f*GeneralInformationWITHQUOTE]![JobNumber]
DoCmd.OpenReport "rScmpDecontaminationGuidelines"
Set Application.Printer = Nothing
Else
Set Application.Printer = Application.Printers("CutePDF Writer")
DoCmd.OpenReport "rRMAPage1", , , "JobNumber=" &
[Forms]![f*GeneralInformationWITHQUOTE]![JobNumber]
Set Application.Printer = Nothing

End If

Exit_CommandEmailRMA_Click:
Exit Sub

Err_CommandEmailRMA_Click:
MsgBox Err.Description
Resume Exit_CommandEmailRMA_Click

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top