|
|
Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Hi,
Some time back, I entered a question asking if it was possible to be in Access, click on a command button, store a created pdf document in a "temp" file so that I might also be able to include, with code, the Access documents that I need to send with this file. I had to pull away from this project, but now am ready to tackle it again. Here is the code that was sent:
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 = "myemail[ at ]myaddress.com" strCC = "myemail[ at ]myaddress.com" strBCC = "myemail[ at ]myaddress.com" 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
When I copied this code and replaced it with my file path, I received a message "Compile Error - Invalid or unqualified reference" and the .pdf is highlighted in the "tmp=" line of code.
Hopefully, I've made what I'm trying to do clear and if anyone can help with this, it would be greatly appreciated. Thanks in advance, Pam
|
|
I don't see anything in that code that should be causing that problem.
Which "tmp=" line is it complaining about? The first one, where you pass it the path and wildcard. or the one inside the While loop? If the one inside the While loop, is it complaining the first time through the loop, or on a later iteration?
What exactly did you change strPath to?
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!)
"PHisaw" <PHisaw[ at ]discussions.microsoft.com> wrote in message news:FFC7963C-4930-4CB1-B814-33AFCBAEF6ED[ at ]microsoft.com...
[Quoted Text] > Hi, > > Some time back, I entered a question asking if it was possible to be in > Access, click on a command button, store a created pdf document in a > "temp" > file so that I might also be able to include, with code, the Access > documents > that I need to send with this file. I had to pull away from this project, > but now am ready to tackle it again. Here is the code that was sent: > > 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 = "myemail[ at ]myaddress.com" > strCC = "myemail[ at ]myaddress.com" > strBCC = "myemail[ at ]myaddress.com" > 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 > > > When I copied this code and replaced it with my file path, I received a > message "Compile Error - Invalid or unqualified reference" and the .pdf > is > highlighted in the "tmp=" line of code. > > Hopefully, I've made what I'm trying to do clear and if anyone can help > with > this, it would be greatly appreciated. > Thanks in advance, > Pam
|
|
Doug, Thanks for the quick reply. Here is the line of code that the .pdf is highlighted in:
tmp = Dir(strPath & “ * .pdfâ€)
I changed the strPath to where the file was located on the server. Is this not right? The info I received with this was that I would have to change the path.
Pam
"Douglas J. Steele" wrote:
[Quoted Text] > I don't see anything in that code that should be causing that problem. > > Which "tmp=" line is it complaining about? The first one, where you pass it > the path and wildcard. or the one inside the While loop? If the one inside > the While loop, is it complaining the first time through the loop, or on a > later iteration? > > What exactly did you change strPath to? > > -- > Doug Steele, Microsoft Access MVP > http://I.Am/DougSteele> (no e-mails, please!) > > > "PHisaw" <PHisaw[ at ]discussions.microsoft.com> wrote in message > news:FFC7963C-4930-4CB1-B814-33AFCBAEF6ED[ at ]microsoft.com... > > Hi, > > > > Some time back, I entered a question asking if it was possible to be in > > Access, click on a command button, store a created pdf document in a > > "temp" > > file so that I might also be able to include, with code, the Access > > documents > > that I need to send with this file. I had to pull away from this project, > > but now am ready to tackle it again. Here is the code that was sent: > > > > 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 = "myemail[ at ]myaddress.com" > > strCC = "myemail[ at ]myaddress.com" > > strBCC = "myemail[ at ]myaddress.com" > > 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 > > > > > > When I copied this code and replaced it with my file path, I received a > > message "Compile Error - Invalid or unqualified reference" and the .pdf > > is > > highlighted in the "tmp=" line of code. > > > > Hopefully, I've made what I'm trying to do clear and if anyone can help > > with > > this, it would be greatly appreciated. > > Thanks in advance, > > Pam > > >
|
|
It might make a difference what you specified, which is why I wanted the exact value.
I just tested using both UNC and mapped drive, and it worked fine for me. (I'm assuming you don't have the spaces around the asterisk)
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!)
"PHisaw" <PHisaw[ at ]discussions.microsoft.com> wrote in message news:FA7B1359-9BCB-4D26-B65A-98442F6F3BF9[ at ]microsoft.com...
[Quoted Text] > Doug, > Thanks for the quick reply. Here is the line of code that the .pdf is > highlighted in: > > tmp = Dir(strPath & " * .pdf") > > I changed the strPath to where the file was located on the server. Is > this > not right? The info I received with this was that I would have to change > the > path. > > Pam > > "Douglas J. Steele" wrote: > >> I don't see anything in that code that should be causing that problem. >> >> Which "tmp=" line is it complaining about? The first one, where you pass >> it >> the path and wildcard. or the one inside the While loop? If the one >> inside >> the While loop, is it complaining the first time through the loop, or on >> a >> later iteration? >> >> What exactly did you change strPath to? >> >> -- >> Doug Steele, Microsoft Access MVP >> http://I.Am/DougSteele>> (no e-mails, please!) >> >> >> "PHisaw" <PHisaw[ at ]discussions.microsoft.com> wrote in message >> news:FFC7963C-4930-4CB1-B814-33AFCBAEF6ED[ at ]microsoft.com... >> > Hi, >> > >> > Some time back, I entered a question asking if it was possible to be in >> > Access, click on a command button, store a created pdf document in a >> > "temp" >> > file so that I might also be able to include, with code, the Access >> > documents >> > that I need to send with this file. I had to pull away from this >> > project, >> > but now am ready to tackle it again. Here is the code that was sent: >> > >> > 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 = "myemail[ at ]myaddress.com" >> > strCC = "myemail[ at ]myaddress.com" >> > strBCC = "myemail[ at ]myaddress.com" >> > 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 >> > >> > >> > When I copied this code and replaced it with my file path, I received a >> > message "Compile Error - Invalid or unqualified reference" and the >> > .pdf >> > is >> > highlighted in the "tmp=" line of code. >> > >> > Hopefully, I've made what I'm trying to do clear and if anyone can help >> > with >> > this, it would be greatly appreciated. >> > Thanks in advance, >> > Pam >> >> >>
|
|
Sorry - here's the code as I have it now.
Private Sub Command235_Click() Dim strFile(10) 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
strPath = "\\dell4lysk21\data\D T S\SCMP DECONTAMINATION GUIDELINESâ€"
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 = "myemail[ at ]myaddress.com" strCC = "myemail[ at ]myaddress.com" strBCC = "myemail[ at ]myaddress.com" 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
"Douglas J. Steele" wrote:
[Quoted Text] > It might make a difference what you specified, which is why I wanted the > exact value. > > I just tested using both UNC and mapped drive, and it worked fine for me. > (I'm assuming you don't have the spaces around the asterisk) > > -- > Doug Steele, Microsoft Access MVP > http://I.Am/DougSteele> (no e-mails, please!) > > > "PHisaw" <PHisaw[ at ]discussions.microsoft.com> wrote in message > news:FA7B1359-9BCB-4D26-B65A-98442F6F3BF9[ at ]microsoft.com... > > Doug, > > Thanks for the quick reply. Here is the line of code that the .pdf is > > highlighted in: > > > > tmp = Dir(strPath & " * .pdf") > > > > I changed the strPath to where the file was located on the server. Is > > this > > not right? The info I received with this was that I would have to change > > the > > path. > > > > Pam > > > > "Douglas J. Steele" wrote: > > > >> I don't see anything in that code that should be causing that problem. > >> > >> Which "tmp=" line is it complaining about? The first one, where you pass > >> it > >> the path and wildcard. or the one inside the While loop? If the one > >> inside > >> the While loop, is it complaining the first time through the loop, or on > >> a > >> later iteration? > >> > >> What exactly did you change strPath to? > >> > >> -- > >> Doug Steele, Microsoft Access MVP > >> http://I.Am/DougSteele> >> (no e-mails, please!) > >> > >> > >> "PHisaw" <PHisaw[ at ]discussions.microsoft.com> wrote in message > >> news:FFC7963C-4930-4CB1-B814-33AFCBAEF6ED[ at ]microsoft.com... > >> > Hi, > >> > > >> > Some time back, I entered a question asking if it was possible to be in > >> > Access, click on a command button, store a created pdf document in a > >> > "temp" > >> > file so that I might also be able to include, with code, the Access > >> > documents > >> > that I need to send with this file. I had to pull away from this > >> > project, > >> > but now am ready to tackle it again. Here is the code that was sent: > >> > > >> > 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 = "myemail[ at ]myaddress.com" > >> > strCC = "myemail[ at ]myaddress.com" > >> > strBCC = "myemail[ at ]myaddress.com" > >> > 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 > >> > > >> > > >> > When I copied this code and replaced it with my file path, I received a > >> > message "Compile Error - Invalid or unqualified reference" and the > >> > .pdf > >> > is > >> > highlighted in the "tmp=" line of code. > >> > > >> > Hopefully, I've made what I'm trying to do clear and if anyone can help > >> > with > >> > this, it would be greatly appreciated. > >> > Thanks in advance, > >> > Pam > >> > >> > >> > > >
|
|
You appear to have a "smart quote" (") rather than a slash at the end of strPath.
I also think you need to remove at least the blank before the * in
tmp = Dir(strPath & " * .pdf")
(I don't think it's possible for a file name to start with a space, which is what that would retrieve)
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!)
"PHisaw" <PHisaw[ at ]discussions.microsoft.com> wrote in message news:E23BDAEF-7E62-42DE-952D-DBB8587D880C[ at ]microsoft.com...
[Quoted Text] > Sorry - here's the code as I have it now. > > Private Sub Command235_Click() > Dim strFile(10) > 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 > > > > strPath = "\\dell4lysk21\data\D T S\SCMP DECONTAMINATION > GUIDELINES"" > > 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 = "myemail[ at ]myaddress.com" > strCC = "myemail[ at ]myaddress.com" > strBCC = "myemail[ at ]myaddress.com" > 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 > > "Douglas J. Steele" wrote: > >> It might make a difference what you specified, which is why I wanted the >> exact value. >> >> I just tested using both UNC and mapped drive, and it worked fine for me. >> (I'm assuming you don't have the spaces around the asterisk) >> >> -- >> Doug Steele, Microsoft Access MVP >> http://I.Am/DougSteele>> (no e-mails, please!) >> >> >> "PHisaw" <PHisaw[ at ]discussions.microsoft.com> wrote in message >> news:FA7B1359-9BCB-4D26-B65A-98442F6F3BF9[ at ]microsoft.com... >> > Doug, >> > Thanks for the quick reply. Here is the line of code that the .pdf is >> > highlighted in: >> > >> > tmp = Dir(strPath & " * .pdf") >> > >> > I changed the strPath to where the file was located on the server. Is >> > this >> > not right? The info I received with this was that I would have to >> > change >> > the >> > path. >> > >> > Pam >> > >> > "Douglas J. Steele" wrote: >> > >> >> I don't see anything in that code that should be causing that problem. >> >> >> >> Which "tmp=" line is it complaining about? The first one, where you >> >> pass >> >> it >> >> the path and wildcard. or the one inside the While loop? If the one >> >> inside >> >> the While loop, is it complaining the first time through the loop, or >> >> on >> >> a >> >> later iteration? >> >> >> >> What exactly did you change strPath to? >> >> >> >> -- >> >> Doug Steele, Microsoft Access MVP >> >> http://I.Am/DougSteele>> >> (no e-mails, please!) >> >> >> >> >> >> "PHisaw" <PHisaw[ at ]discussions.microsoft.com> wrote in message >> >> news:FFC7963C-4930-4CB1-B814-33AFCBAEF6ED[ at ]microsoft.com... >> >> > Hi, >> >> > >> >> > Some time back, I entered a question asking if it was possible to be >> >> > in >> >> > Access, click on a command button, store a created pdf document in a >> >> > "temp" >> >> > file so that I might also be able to include, with code, the Access >> >> > documents >> >> > that I need to send with this file. I had to pull away from this >> >> > project, >> >> > but now am ready to tackle it again. Here is the code that was >> >> > sent: >> >> > >> >> > 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 = "myemail[ at ]myaddress.com" >> >> > strCC = "myemail[ at ]myaddress.com" >> >> > strBCC = "myemail[ at ]myaddress.com" >> >> > 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 >> >> > >> >> > >> >> > When I copied this code and replaced it with my file path, I >> >> > received a >> >> > message "Compile Error - Invalid or unqualified reference" and the >> >> > .pdf >> >> > is >> >> > highlighted in the "tmp=" line of code. >> >> > >> >> > Hopefully, I've made what I'm trying to do clear and if anyone can >> >> > help >> >> > with >> >> > this, it would be greatly appreciated. >> >> > Thanks in advance, >> >> > Pam >> >> >> >> >> >> >> >> >>
|
|
Pam,
As well as removing the spaces, you might also need to retype this line, as it appears to be enclosed in “” rather than "" (which probably indicates it was originally copy/pasted from a word processor or newsreader which munged it).
-- Steve Schapel, Microsoft Access MVP
Douglas J. Steele wrote:
[Quoted Text] > You appear to have a "smart quote" (") rather than a slash at the end of > strPath. > > I also think you need to remove at least the blank before the * in > > tmp = Dir(strPath & " * .pdf") > > (I don't think it's possible for a file name to start with a space, which is > what that would retrieve) >
|
|
Doug/Steve, Thanks again for the help. I've got past this line of code, but it's stopping at the last line of text shown below. I've only entered the first part up to where it's causing an error. I also wanted you to verify the changes were correct I made. On the last line, I get message "User-defined type not defined".
Thanks, Pam
"Steve Schapel" wrote:
[Quoted Text] > Pam, > > As well as removing the spaces, you might also need to retype this line, > as it appears to be enclosed in Ҡrather than "" (which probably > indicates it was originally copy/pasted from a word processor or > newsreader which munged it). > > -- > Steve Schapel, Microsoft Access MVP > > Douglas J. Steele wrote: > > You appear to have a "smart quote" (") rather than a slash at the end of > > strPath. > > > > I also think you need to remove at least the blank before the * in > > > > tmp = Dir(strPath & " * .pdf") > > > > (I don't think it's possible for a file name to start with a space, which is > > what that would retrieve) > > >
|
|
Sorry I forgot to paste the code in
strPath = "\\dell4lysk21\data\D T S\SCMP DECONTAMINATION GUIDELINES\"
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
"Steve Schapel" wrote:
[Quoted Text] > Pam, > > As well as removing the spaces, you might also need to retype this line, > as it appears to be enclosed in Ҡrather than "" (which probably > indicates it was originally copy/pasted from a word processor or > newsreader which munged it). > > -- > Steve Schapel, Microsoft Access MVP > > Douglas J. Steele wrote: > > You appear to have a "smart quote" (") rather than a slash at the end of > > strPath. > > > > I also think you need to remove at least the blank before the * in > > > > tmp = Dir(strPath & " * .pdf") > > > > (I don't think it's possible for a file name to start with a space, which is > > what that would retrieve) > > >
|
|
Have you set a reference to Outlook (through Tools | References)?
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please)
"PHisaw" <PHisaw[ at ]discussions.microsoft.com> wrote in message news:88E58A25-4998-44AE-88DE-9079E2043869[ at ]microsoft.com...
[Quoted Text] > Sorry I forgot to paste the code in > > strPath = "\\dell4lysk21\data\D T S\SCMP DECONTAMINATION GUIDELINES\" > > 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 > > "Steve Schapel" wrote: > >> Pam, >> >> As well as removing the spaces, you might also need to retype this line, >> as it appears to be enclosed in "" rather than "" (which probably >> indicates it was originally copy/pasted from a word processor or >> newsreader which munged it). >> >> -- >> Steve Schapel, Microsoft Access MVP >> >> Douglas J. Steele wrote: >> > You appear to have a "smart quote" (") rather than a slash at the end >> > of >> > strPath. >> > >> > I also think you need to remove at least the blank before the * in >> > >> > tmp = Dir(strPath & " * .pdf") >> > >> > (I don't think it's possible for a file name to start with a space, >> > which is >> > what that would retrieve) >> > >>
|
|
No, can you tell me how to set the reference? I'll have to wait until Monday to do anything further with this.
Thanks again for the time and help! Pam
"Douglas J. Steele" wrote:
[Quoted Text] > Have you set a reference to Outlook (through Tools | References)? > > -- > Doug Steele, Microsoft Access MVP > http://I.Am/DougSteele> (no private e-mails, please) > > > "PHisaw" <PHisaw[ at ]discussions.microsoft.com> wrote in message > news:88E58A25-4998-44AE-88DE-9079E2043869[ at ]microsoft.com... > > Sorry I forgot to paste the code in > > > > strPath = "\\dell4lysk21\data\D T S\SCMP DECONTAMINATION GUIDELINES\" > > > > 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 > > > > "Steve Schapel" wrote: > > > >> Pam, > >> > >> As well as removing the spaces, you might also need to retype this line, > >> as it appears to be enclosed in "" rather than "" (which probably > >> indicates it was originally copy/pasted from a word processor or > >> newsreader which munged it). > >> > >> -- > >> Steve Schapel, Microsoft Access MVP > >> > >> Douglas J. Steele wrote: > >> > You appear to have a "smart quote" (") rather than a slash at the end > >> > of > >> > strPath. > >> > > >> > I also think you need to remove at least the blank before the * in > >> > > >> > tmp = Dir(strPath & " * .pdf") > >> > > >> > (I don't think it's possible for a file name to start with a space, > >> > which is > >> > what that would retrieve) > >> > > >> > > >
|
|
With any code module open, select Tools | References from the menu.
Scroll through the list of available references until you come to the appropriate Microsoft Outlook n.0 Object Library entry (n will depend on what version of Outlook you have).
Check that reference, then back out of the dialog.
Note, though, that if you're distributing this application to other users and they don't have the exact same version of Outlook, you're going to run into problems.
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please)
"PHisaw" <PHisaw[ at ]discussions.microsoft.com> wrote in message news:B4EA5B9C-66A3-4FE4-BE55-317C164E8B57[ at ]microsoft.com...
[Quoted Text] > No, can you tell me how to set the reference? I'll have to wait until > Monday > to do anything further with this. > > Thanks again for the time and help! > Pam > > "Douglas J. Steele" wrote: > >> Have you set a reference to Outlook (through Tools | References)? >> >> -- >> Doug Steele, Microsoft Access MVP >> http://I.Am/DougSteele>> (no private e-mails, please) >> >> >> "PHisaw" <PHisaw[ at ]discussions.microsoft.com> wrote in message >> news:88E58A25-4998-44AE-88DE-9079E2043869[ at ]microsoft.com... >> > Sorry I forgot to paste the code in >> > >> > strPath = "\\dell4lysk21\data\D T S\SCMP DECONTAMINATION GUIDELINES\" >> > >> > 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 >> > >> > "Steve Schapel" wrote: >> > >> >> Pam, >> >> >> >> As well as removing the spaces, you might also need to retype this >> >> line, >> >> as it appears to be enclosed in "" rather than "" (which probably >> >> indicates it was originally copy/pasted from a word processor or >> >> newsreader which munged it). >> >> >> >> -- >> >> Steve Schapel, Microsoft Access MVP >> >> >> >> Douglas J. Steele wrote: >> >> > You appear to have a "smart quote" (") rather than a slash at the >> >> > end >> >> > of >> >> > strPath. >> >> > >> >> > I also think you need to remove at least the blank before the * in >> >> > >> >> > tmp = Dir(strPath & " * .pdf") >> >> > >> >> > (I don't think it's possible for a file name to start with a space, >> >> > which is >> >> > what that would retrieve) >> >> > >> >> >> >> >>
|
|
This sounds like it getting even more complicated - by "distributing this application" are you saying that if I send a pdf with this procedure, it can cause problems?
"Douglas J. Steele" wrote:
[Quoted Text] > With any code module open, select Tools | References from the menu. > > Scroll through the list of available references until you come to the > appropriate Microsoft Outlook n.0 Object Library entry (n will depend on > what version of Outlook you have). > > Check that reference, then back out of the dialog. > > Note, though, that if you're distributing this application to other users > and they don't have the exact same version of Outlook, you're going to run > into problems. > > -- > Doug Steele, Microsoft Access MVP > http://I.Am/DougSteele> (no private e-mails, please) > > > "PHisaw" <PHisaw[ at ]discussions.microsoft.com> wrote in message > news:B4EA5B9C-66A3-4FE4-BE55-317C164E8B57[ at ]microsoft.com... > > No, can you tell me how to set the reference? I'll have to wait until > > Monday > > to do anything further with this. > > > > Thanks again for the time and help! > > Pam > > > > "Douglas J. Steele" wrote: > > > >> Have you set a reference to Outlook (through Tools | References)? > >> > >> -- > >> Doug Steele, Microsoft Access MVP > >> http://I.Am/DougSteele> >> (no private e-mails, please) > >> > >> > >> "PHisaw" <PHisaw[ at ]discussions.microsoft.com> wrote in message > >> news:88E58A25-4998-44AE-88DE-9079E2043869[ at ]microsoft.com... > >> > Sorry I forgot to paste the code in > >> > > >> > strPath = "\\dell4lysk21\data\D T S\SCMP DECONTAMINATION GUIDELINES\" > >> > > >> > 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 > >> > > >> > "Steve Schapel" wrote: > >> > > >> >> Pam, > >> >> > >> >> As well as removing the spaces, you might also need to retype this > >> >> line, > >> >> as it appears to be enclosed in "" rather than "" (which probably > >> >> indicates it was originally copy/pasted from a word processor or > >> >> newsreader which munged it). > >> >> > >> >> -- > >> >> Steve Schapel, Microsoft Access MVP > >> >> > >> >> Douglas J. Steele wrote: > >> >> > You appear to have a "smart quote" (") rather than a slash at the > >> >> > end > >> >> > of > >> >> > strPath. > >> >> > > >> >> > I also think you need to remove at least the blank before the * in > >> >> > > >> >> > tmp = Dir(strPath & " * .pdf") > >> >> > > >> >> > (I don't think it's possible for a file name to start with a space, > >> >> > which is > >> >> > what that would retrieve) > >> >> > > >> >> > >> > >> > >> > > >
|
|
No, I'm saying you can run into problems if you distribute the MDB to other people so they can use it to send PDF files.
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please)
"PHisaw" <PHisaw[ at ]discussions.microsoft.com> wrote in message news:91F536DB-FFF6-47CA-BB72-F5879C3A0FB5[ at ]microsoft.com...
[Quoted Text] > This sounds like it getting even more complicated - by "distributing this > application" are you saying that if I send a pdf with this procedure, it > can > cause problems? > > "Douglas J. Steele" wrote: > >> With any code module open, select Tools | References from the menu. >> >> Scroll through the list of available references until you come to the >> appropriate Microsoft Outlook n.0 Object Library entry (n will depend on >> what version of Outlook you have). >> >> Check that reference, then back out of the dialog. >> >> Note, though, that if you're distributing this application to other users >> and they don't have the exact same version of Outlook, you're going to >> run >> into problems. >> >> -- >> Doug Steele, Microsoft Access MVP >> http://I.Am/DougSteele>> (no private e-mails, please) >> >> >> "PHisaw" <PHisaw[ at ]discussions.microsoft.com> wrote in message >> news:B4EA5B9C-66A3-4FE4-BE55-317C164E8B57[ at ]microsoft.com... >> > No, can you tell me how to set the reference? I'll have to wait until >> > Monday >> > to do anything further with this. >> > >> > Thanks again for the time and help! >> > Pam >> > >> > "Douglas J. Steele" wrote: >> > >> >> Have you set a reference to Outlook (through Tools | References)? >> >> >> >> -- >> >> Doug Steele, Microsoft Access MVP >> >> http://I.Am/DougSteele>> >> (no private e-mails, please) >> >> >> >> >> >> "PHisaw" <PHisaw[ at ]discussions.microsoft.com> wrote in message >> >> news:88E58A25-4998-44AE-88DE-9079E2043869[ at ]microsoft.com... >> >> > Sorry I forgot to paste the code in >> >> > >> >> > strPath = "\\dell4lysk21\data\D T S\SCMP DECONTAMINATION >> >> > GUIDELINES\" >> >> > >> >> > 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 >> >> > >> >> > "Steve Schapel" wrote: >> >> > >> >> >> Pam, >> >> >> >> >> >> As well as removing the spaces, you might also need to retype this >> >> >> line, >> >> >> as it appears to be enclosed in "" rather than "" (which probably >> >> >> indicates it was originally copy/pasted from a word processor or >> >> >> newsreader which munged it). >> >> >> >> >> >> -- >> >> >> Steve Schapel, Microsoft Access MVP >> >> >> >> >> >> Douglas J. Steele wrote: >> >> >> > You appear to have a "smart quote" (") rather than a slash at the >> >> >> > end >> >> >> > of >> >> >> > strPath. >> >> >> > >> >> >> > I also think you need to remove at least the blank before the * >> >> >> > in >> >> >> > >> >> >> > tmp = Dir(strPath & " * .pdf") >> >> >> > >> >> >> > (I don't think it's possible for a file name to start with a >> >> >> > space, >> >> >> > which is >> >> >> > what that would retrieve) >> >> >> > >> >> >> >> >> >> >> >> >> >> >> >>
|
|
|