djames2173
Technical User
I have created a memo form in MS Word and have VBA macro coding for when users complete an input form which inputs the information into bookmarks of the document. There is also a macro button that i have used VBA code to attach the active, saved document to the email. The problem is that this code is only attaching the document if it is saved within Windows Explorer and not if it is saved in Docs Open 4.0 [Document Management System]. It seems that the ActiveDocument.Path is returing empty appearing as if the document was not saved. Also the ActiveDocument.FullName is appearing with the ODMA path. Oh yeah, the integration for Docs & MS Word 2003 uses ODMA. Below is the code i am using. Any help is greatly appreciated.
Private Sub cmdSendEmemo_Click()
'''Don't forget to set a reference to the Outlook object library 8.0
Dim sEmailAddress As String
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
'''this checks to see if the active document has been saved at least once
If Len(ActiveDocument.Path) = 0 Then
MsgBox "Document needs to be saved first"
Exit Sub
End If
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If
Set oItem = oOutlookApp.CreateItem(olMailItem)
'''go to EmailAddress bookmark to get e-mail addresses for email
Selection.GoTo What:=wdGoToBookmark, Name:="EmailAddress"
sEmailAddress = Selection.Text
With oItem
'''this is where the stored e-mail address is used for populating the message
.To = sEmailAddress
.Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue, _
DisplayName:="Document as attachment"
End With
oItem.Display
If bStarted Then
oOutlookApp.Quit
End If
'''clean up
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub
Private Sub cmdSendEmemo_Click()
'''Don't forget to set a reference to the Outlook object library 8.0
Dim sEmailAddress As String
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
'''this checks to see if the active document has been saved at least once
If Len(ActiveDocument.Path) = 0 Then
MsgBox "Document needs to be saved first"
Exit Sub
End If
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If
Set oItem = oOutlookApp.CreateItem(olMailItem)
'''go to EmailAddress bookmark to get e-mail addresses for email
Selection.GoTo What:=wdGoToBookmark, Name:="EmailAddress"
sEmailAddress = Selection.Text
With oItem
'''this is where the stored e-mail address is used for populating the message
.To = sEmailAddress
.Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue, _
DisplayName:="Document as attachment"
End With
oItem.Display
If bStarted Then
oOutlookApp.Quit
End If
'''clean up
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub