If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
email pdf document
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" wrote in message ... 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) |
#12
|
|||
|
|||
email pdf document
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" wrote in message ... 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" wrote in message ... 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) |
#13
|
|||
|
|||
email pdf document
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" wrote in message ... 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" wrote in message ... 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) |
#14
|
|||
|
|||
email pdf document
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" wrote in message ... 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" wrote in message ... 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" wrote in message ... 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) |
#15
|
|||
|
|||
email pdf document
If I set the reference (by this do you mean checking the box "Microsoft 11.0
Object Library"?) and then everyone copies the front end to their computer, will this still cause problems? "Douglas J. Steele" wrote: 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" wrote in message ... 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" wrote in message ... 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" wrote in message ... 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) |
#16
|
|||
|
|||
email pdf document
If they don't have Outlook 2002 on their machine, it will definitely cause a
problem. If they have a different version of Outlook 2002 than you (i.e.: different service pack), it may cause a problem. It's for this reason that many developers choose to use Late Binding, rather than setting references. Tony Toews has an introduction to the topic at http://www.granite.ab.ca/access/latebinding.htm -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "PHisaw" wrote in message ... If I set the reference (by this do you mean checking the box "Microsoft 11.0 Object Library"?) and then everyone copies the front end to their computer, will this still cause problems? "Douglas J. Steele" wrote: 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" wrote in message ... 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" wrote in message ... 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" wrote in message ... 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) |
#17
|
|||
|
|||
email pdf document
I really would like to get this to work as I hope it will. I certainly do
appreciate your time and help with this and ask that you please bear with me. I feel this is way over my head in what little I do know about Access. This is what I have done - I took out everything under the word Wend and replaced it with the code below. I ran it and it still stops at SetolApp=NewOutlook.Application with error msg "Compile Error: User defined type not defined". Do I need to go to references and check the box "Microsoft 11.0 Object Library"? Dim olApp As Outlook.Application Dim olMailMessage As Outlook.MailItem Dim olRecipient As Outlook.Recipient Dim blnKnownRecipient As Boolean ' Create new instance of Outlook or open current instance. Set olApp = New Outlook.Application ' Create new message. Set olMailMessage = olApp.CreateItem(olMailItem) ' Prompt for message recipient, attempt to resolve address, and ' then send or display. With olMailMessage Set olRecipient = .Recipients.Add(InputBox("Enter name of message recipient", _ "Recipient Name")) blnKnownRecipient = olRecipient.Resolve .Subject = "Testing mail by Automation" .Body = "This message was created by VBA code running " _ & "Outlook through Automation." If blnKnownRecipient = True Then .Send Else .Display End If End With Set olMailMessage = Nothing olApp.Quit Set olApp = Nothing End Sub "Douglas J. Steele" wrote: If they don't have Outlook 2002 on their machine, it will definitely cause a problem. If they have a different version of Outlook 2002 than you (i.e.: different service pack), it may cause a problem. It's for this reason that many developers choose to use Late Binding, rather than setting references. Tony Toews has an introduction to the topic at http://www.granite.ab.ca/access/latebinding.htm -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "PHisaw" wrote in message ... If I set the reference (by this do you mean checking the box "Microsoft 11.0 Object Library"?) and then everyone copies the front end to their computer, will this still cause problems? "Douglas J. Steele" wrote: 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" wrote in message ... 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" wrote in message ... 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" wrote in message ... 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) |
#18
|
|||
|
|||
email pdf document
It's not "Microsoft 11.0 Object Library", it's "Microsoft Outlook 11.0
Object Library" However, to convert your code to Late Binding, you need to make the following changes to your code: 1) Dim olApp As Outlook.Application Dim olMailMessage As Outlook.MailItem Dim olRecipient As Outlook.Recipient needs to be Dim olApp As Object Dim olMailMessage As Object Dim olRecipient As Object 2) Set olApp = New Outlook.Application needs to be Set olApp = CreateObject("Outlook.Application") 3) Set olMailMessage = olApp.CreateItem(olMailItem) needs to be Set olMailMessage = olApp.CreateItem(0) I think that's it. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "PHisaw" wrote in message ... I really would like to get this to work as I hope it will. I certainly do appreciate your time and help with this and ask that you please bear with me. I feel this is way over my head in what little I do know about Access. This is what I have done - I took out everything under the word Wend and replaced it with the code below. I ran it and it still stops at SetolApp=NewOutlook.Application with error msg "Compile Error: User defined type not defined". Do I need to go to references and check the box "Microsoft 11.0 Object Library"? Dim olApp As Outlook.Application Dim olMailMessage As Outlook.MailItem Dim olRecipient As Outlook.Recipient Dim blnKnownRecipient As Boolean ' Create new instance of Outlook or open current instance. Set olApp = New Outlook.Application ' Create new message. Set olMailMessage = olApp.CreateItem(olMailItem) ' Prompt for message recipient, attempt to resolve address, and ' then send or display. With olMailMessage Set olRecipient = .Recipients.Add(InputBox("Enter name of message recipient", _ "Recipient Name")) blnKnownRecipient = olRecipient.Resolve .Subject = "Testing mail by Automation" .Body = "This message was created by VBA code running " _ & "Outlook through Automation." If blnKnownRecipient = True Then .Send Else .Display End If End With Set olMailMessage = Nothing olApp.Quit Set olApp = Nothing End Sub "Douglas J. Steele" wrote: If they don't have Outlook 2002 on their machine, it will definitely cause a problem. If they have a different version of Outlook 2002 than you (i.e.: different service pack), it may cause a problem. It's for this reason that many developers choose to use Late Binding, rather than setting references. Tony Toews has an introduction to the topic at http://www.granite.ab.ca/access/latebinding.htm -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "PHisaw" wrote in message ... If I set the reference (by this do you mean checking the box "Microsoft 11.0 Object Library"?) and then everyone copies the front end to their computer, will this still cause problems? "Douglas J. Steele" wrote: 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" wrote in message ... 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" wrote in message ... 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" wrote in message ... 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) |
#19
|
|||
|
|||
email pdf document
Oops! Sorry for the "Outlook" omission. I made the changes and it asked for
the recepient name and a warning box asking if this is what I wanted. I selected yes and I don't think it agreed with my computer. The open windows weren't complete screens and it was flickering. This is proving to be a lot more difficult than I thought it would be. I originally had documents created in Access and would use CutePdf to output them to a temp file as a pdf document. Due to necessary changes, one of the documents had to be a pdf document created outside Access. I was hoping that I could click a command button send those that are in Access and "grab" the one outside Access, bring to a temp file, then go to the temp file and email all. I don't think this is working the way I had hoped. I think I'll leave it as is. Thanks again for your time and help. Very much appreciated. Pam "Douglas J. Steele" wrote: It's not "Microsoft 11.0 Object Library", it's "Microsoft Outlook 11.0 Object Library" However, to convert your code to Late Binding, you need to make the following changes to your code: 1) Dim olApp As Outlook.Application Dim olMailMessage As Outlook.MailItem Dim olRecipient As Outlook.Recipient needs to be Dim olApp As Object Dim olMailMessage As Object Dim olRecipient As Object 2) Set olApp = New Outlook.Application needs to be Set olApp = CreateObject("Outlook.Application") 3) Set olMailMessage = olApp.CreateItem(olMailItem) needs to be Set olMailMessage = olApp.CreateItem(0) I think that's it. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "PHisaw" wrote in message ... I really would like to get this to work as I hope it will. I certainly do appreciate your time and help with this and ask that you please bear with me. I feel this is way over my head in what little I do know about Access. This is what I have done - I took out everything under the word Wend and replaced it with the code below. I ran it and it still stops at SetolApp=NewOutlook.Application with error msg "Compile Error: User defined type not defined". Do I need to go to references and check the box "Microsoft 11.0 Object Library"? Dim olApp As Outlook.Application Dim olMailMessage As Outlook.MailItem Dim olRecipient As Outlook.Recipient Dim blnKnownRecipient As Boolean ' Create new instance of Outlook or open current instance. Set olApp = New Outlook.Application ' Create new message. Set olMailMessage = olApp.CreateItem(olMailItem) ' Prompt for message recipient, attempt to resolve address, and ' then send or display. With olMailMessage Set olRecipient = .Recipients.Add(InputBox("Enter name of message recipient", _ "Recipient Name")) blnKnownRecipient = olRecipient.Resolve .Subject = "Testing mail by Automation" .Body = "This message was created by VBA code running " _ & "Outlook through Automation." If blnKnownRecipient = True Then .Send Else .Display End If End With Set olMailMessage = Nothing olApp.Quit Set olApp = Nothing End Sub "Douglas J. Steele" wrote: If they don't have Outlook 2002 on their machine, it will definitely cause a problem. If they have a different version of Outlook 2002 than you (i.e.: different service pack), it may cause a problem. It's for this reason that many developers choose to use Late Binding, rather than setting references. Tony Toews has an introduction to the topic at http://www.granite.ab.ca/access/latebinding.htm -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "PHisaw" wrote in message ... If I set the reference (by this do you mean checking the box "Microsoft 11.0 Object Library"?) and then everyone copies the front end to their computer, will this still cause problems? "Douglas J. Steele" wrote: 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" wrote in message ... 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" wrote in message ... 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" wrote in message ... 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) |
#20
|
|||
|
|||
email pdf document
Sorry, we don't use Outlook here, so I can't verify that the code should
work. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "PHisaw" wrote in message ... Oops! Sorry for the "Outlook" omission. I made the changes and it asked for the recepient name and a warning box asking if this is what I wanted. I selected yes and I don't think it agreed with my computer. The open windows weren't complete screens and it was flickering. This is proving to be a lot more difficult than I thought it would be. I originally had documents created in Access and would use CutePdf to output them to a temp file as a pdf document. Due to necessary changes, one of the documents had to be a pdf document created outside Access. I was hoping that I could click a command button send those that are in Access and "grab" the one outside Access, bring to a temp file, then go to the temp file and email all. I don't think this is working the way I had hoped. I think I'll leave it as is. Thanks again for your time and help. Very much appreciated. Pam "Douglas J. Steele" wrote: It's not "Microsoft 11.0 Object Library", it's "Microsoft Outlook 11.0 Object Library" However, to convert your code to Late Binding, you need to make the following changes to your code: 1) Dim olApp As Outlook.Application Dim olMailMessage As Outlook.MailItem Dim olRecipient As Outlook.Recipient needs to be Dim olApp As Object Dim olMailMessage As Object Dim olRecipient As Object 2) Set olApp = New Outlook.Application needs to be Set olApp = CreateObject("Outlook.Application") 3) Set olMailMessage = olApp.CreateItem(olMailItem) needs to be Set olMailMessage = olApp.CreateItem(0) I think that's it. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "PHisaw" wrote in message ... I really would like to get this to work as I hope it will. I certainly do appreciate your time and help with this and ask that you please bear with me. I feel this is way over my head in what little I do know about Access. This is what I have done - I took out everything under the word Wend and replaced it with the code below. I ran it and it still stops at SetolApp=NewOutlook.Application with error msg "Compile Error: User defined type not defined". Do I need to go to references and check the box "Microsoft 11.0 Object Library"? Dim olApp As Outlook.Application Dim olMailMessage As Outlook.MailItem Dim olRecipient As Outlook.Recipient Dim blnKnownRecipient As Boolean ' Create new instance of Outlook or open current instance. Set olApp = New Outlook.Application ' Create new message. Set olMailMessage = olApp.CreateItem(olMailItem) ' Prompt for message recipient, attempt to resolve address, and ' then send or display. With olMailMessage Set olRecipient = .Recipients.Add(InputBox("Enter name of message recipient", _ "Recipient Name")) blnKnownRecipient = olRecipient.Resolve .Subject = "Testing mail by Automation" .Body = "This message was created by VBA code running " _ & "Outlook through Automation." If blnKnownRecipient = True Then .Send Else .Display End If End With Set olMailMessage = Nothing olApp.Quit Set olApp = Nothing End Sub "Douglas J. Steele" wrote: If they don't have Outlook 2002 on their machine, it will definitely cause a problem. If they have a different version of Outlook 2002 than you (i.e.: different service pack), it may cause a problem. It's for this reason that many developers choose to use Late Binding, rather than setting references. Tony Toews has an introduction to the topic at http://www.granite.ab.ca/access/latebinding.htm -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "PHisaw" wrote in message ... If I set the reference (by this do you mean checking the box "Microsoft 11.0 Object Library"?) and then everyone copies the front end to their computer, will this still cause problems? "Douglas J. Steele" wrote: 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" wrote in message ... 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" wrote in message ... 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" wrote in message ... 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) |
|
Thread Tools | |
Display Modes | |
|
|