Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / December 2004

Tip: Looking for answers? Try searching our database.

sending an active document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
blgsai - 30 Nov 2004 20:22 GMT
I am using the code below to send the active document in
Word as an attachment in an Outlook mail item.  The issue
is the document path.  If the active documents path is
saved on the users hard drive eg. C:\Testfile.txt,
it works fine but if it is a document that is saved in our
document management system, it doesn't attach
it in the email. Am I missing something?  See code below
(Line 11, 12 & 13).  

I am able to get the path - ::ODMA\PCDOCS\VAN01\2044141\1
and I tried adding it in two different ways (line 11 and
12) but it doesn't add the attachment.
Yet, line 13 works.

Sub SendActiveDocument()

Dim DocName
DocName = ActiveDocument.FullName
MsgBox DocName

Dim myOutlook As Outlook.Application
Dim myoItem As Outlook.MailItem
Dim myAttachment As Outlook.Attachments

On Error Resume Next

Set myOutlook = New Outlook.Application
Set myoItem = myOutlook.CreateItem(olMailItem)
Set myAttachment = myoItem.Attachments

11:  myAttachment.Add Source:=Name, Type:=olByValue,
Position:=1,
DisplayName:="TEST"
12:  'myAttachment.Add "::ODMA\PCDOCS\VAN01\2044141\1",
olByValue, 1, "TEST"
13:  'myAttachment.Add "C:\testfile.txt", olByValue,
1, "TEST"

'Let user manually send email after adding recepients,
subject and body
myoItem.Display

End Sub
.
Cindy M  -WordMVP- - 09 Dec 2004 14:18 GMT
Hi Blgsai,

Try asking this in an Outlook newsgroup. And be sure to
mention the type of document management system you have. I'd
also ask the manufacturer of this system, as it's possible
it's somehow locking the file.

As a last-resort workaround, could you save the document to a
temp path, locally, send it, then save back to the "correct"
path? (And later delete the temp file)

> I am using the code below to send the active document in
> Word as an attachment in an Outlook mail item.  The issue
[quoted text clipped - 4 lines]
> it in the email. Am I missing something?  See code below
> (Line 11, 12 & 13).

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun
8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail :-)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.