this code works GREAT!!! ... but i have yet another question.. or 2... how do you attach it as a shortcut? i am using outlook. even a hyperlink would work, but i can't seem to figure that one out either? any ideas?
Are you looking to just point to the file location i.e. a shortcut? Depending on your network configuration this may or may not work. You can send a hyperlink that points to the location of a file on the network: C:\Access\Test.DOC or \\bravo\access\Test.DOC if the drives aren't named. I don't really like to send hyperlinks of files that reside on a network because not all drives/locations are shared and not all users may use the same drive map i.e. my D:\ might not be your D:\. If you want to place the attachment at the end of the document try this snippet:
The piece "Len(txt_Body)+100" checks the length of the body text and moves the attachment out 100 more characters. This will place the attachment nicely at the end of the email.
Let me know if this helps or if you were looking for something else...
That should work, but unfortunatly i get an error saying something about it not supporting HTML... i am using outlook 97. for the people i will be sending this report to, i have it out on a drive that they all have access to, so that part won't be a problem, as for the hyperlink, how can i have it that they see "Report Name" and not the whole "<\\X:\Reports\My Report.xls\>"?
gives the actual address. In between those tags is the lable for the link, in this example Tek-Tips. Then the closing tag </a>. By the way these tags are called anchor tags.
For a location on a drive I would write it as such:
<a href="X:/Reports/My Report.xls">Check Out My Report</a>
Give this a shot and see if it works. If it doesn't we'll massage the HTML until it does!
yea i got it to work, i can't use html code for some reason, but "file://X:\Reports\MyReport.xls" works great.
Thank you for your help, i really do appreciate it.
Hmm... No HTML code? Are you specifying .HTMLBody as opposed to .Body when you are building the email? That might be the root of the problem. All the same I'm glad it is working out.
Outlook is a pretty powerful tool and there are some neat things you can do with tasks, calendars, and emails through Access. At my company we update task lists and calendars out of Access, when there is a change in the system we push that change out to the users. Good luck with your code and let me know if you need any help!
it wouldn't let me specify HTMLBody, it didn't have the option, and when i just typed it in, it yelled at me and said there is an error. how do i set it so i can select it from the list? also i have gone into the object browser and seen attachment as a selection, but i haven't ever seen it in those little selection boxes... any ideas?
Do you want to forward on the code that you are using to create the email? Could be a couple of things... I'm assuming that you are using Access 97...
Let me know. Thanks!
jelwood01
Private Sub CmdSend_Click()
Dim appOut As Outlook.Application
Dim EMailOut As Outlook.MailItem
Dim MthYr As String
Set appOut = CreateObject("Outlook.Application"
Set EMailOut = appOut.CreateItem(olMailItem)
MthYr = Format(txtDate, "mmmm - yyyy"
With EMailOut
.To = "Jared Taylor"
.CC = "Makensey Murdock"
.Subject = "Waved Fees Report for " & MthYr
.Body = "The Waved Fees Report for " & MthYr & " has been updated." & vbNewLine & _
"Please click on the link below to view." & vbNewLine & vbNewLine & _
"file://X:\assetmgt\WavedFees.xls" & vbNewLine & vbNewLine & _
"If you have any questions or comments please feel free to contact Reporting by email or phone (57134)" _
& vbNewLine & "Thank You"
.ReadReceiptRequested = False
.Display
End With
Ah-Ha... I should have done my homework a little better! The reason behind your HTML woes is that Outlook 97 doesn't support HTMLBody as an object... Here is the link for the Map of the Outlook 97 object model:
My apologies on this one. I am running Outlook 98 and Outlook 2000, both of which support HTMLBody. Code looks good and the link comes out nicely and it does the job!
97 seems to only support plain text and RTF and I am not sure of a work around on that. If I find something, though, I'll let you know.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.