help! email attachment is blank

T

Terye N

I've created a document template with a userform. When I pull up a new
document, I want to be able to "fill in the blanks" on the user form, update
the document, and have it sent automatically to a specific email address. I'm
using Word 2003 and Groupwise. So far so good ... it sends the document to
my email, but when I open the document from my email, it is a new - blank -
document, not document with saved information. Here is the code I'm using:

Private Sub Commandok_Click()
Application.ScreenUpdating = False
With ActiveDocument
.Bookmarks("text1").Range.Text = TextBox1.Value
.Bookmarks("text2").Range.Text = TextBox2.Value
.Bookmarks("text3").Range.Text = TextBox3.Value
End With
Application.ScreenUpdating = True
Unload Me

Temp = ActiveDocument.Name
'Open a GroupWare session Object
Set GWApp = CreateObject("NovellGroupWareSession") ' login to GW
'Login using () will login to the open account or run the login
'script if none was opened.
Set gWAccount = GWApp.Login()
'Create a new message in the Mailbox
Set gwMessage = gWAccount.MailBox.Messages.Add
gwMessage.Subject = "Complaint Form"
gwMessage.BodyText = "Please review the enclosed complaint form"
gwMessage.Recipients.Add "(e-mail address removed)"
gwMessage.Attachments.Add Temp 'Add an open workbook to the attachments
gwMessage.Send 'Send out
MsgBox ("Your message been successfully sent!")
ActiveDocument.Close

End Sub

I'm missing something, somewhere ... any help at all would be MUCH appreciated
 
D

David Sisson

Private Sub Commandok_Click()
Application.ScreenUpdating = False
With ActiveDocument
    .Bookmarks("text1").Range.Text = TextBox1.Value
    .Bookmarks("text2").Range.Text = TextBox2.Value
    .Bookmarks("text3").Range.Text = TextBox3.Value
End With
Application.ScreenUpdating = True
Unload Me

I believe the document has to be saved first. (A snipit from a email
routine I use.)
If Len(ActiveDocument.Path) = 0 Then
MsgBox "Document needs to be saved first"
Exit Sub
End If
 
T

Terye N

The problem is, I don't want them to save it, but send it directly to me. I
can accomplish this with activedocument.sendmail -- but that requires the
user to type in my email address, and I want it to be automated if at all
possible. This is driving me crazy!!
 
D

Doug Robbins - Word MVP

Save it and then Kill it if you do not want a copy retained.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
T

Tony Jollans

I'm afraid you won't be able to do this - or at least not very easily. When
you use the UI, Word saves a copy in a temporary folder which it can then
attach to the e-mail (where probably depends on the e-mail client you use).
And you need to do the same, which, for you, means duplicating the document
(not always a straightforward task with an unsaved document - it depends on
your content) and determining a temporary location to use that will be
tidied up later - or doing your own tidy up and for this you need to be sure
that the temporary copy is not needed any more before you delete it. I'm
talking round this because I have never done it and am not entirely sure of
all the factors you need to consider.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top