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 / January 2008

Tip: Looking for answers? Try searching our database.

help! email attachment is blank

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Terye N - 02 Jan 2008 18:01 GMT
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 "nikolatv@ah.org"
   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
David Sisson - 02 Jan 2008 19:08 GMT
> Private Sub Commandok_Click()
> Application.ScreenUpdating = False
[quoted text clipped - 5 lines]
> 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

> 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
Terye N - 02 Jan 2008 19:51 GMT
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!!

> > Private Sub Commandok_Click()
> > Application.ScreenUpdating = False
[quoted text clipped - 17 lines]
> > Set GWApp = CreateObject("NovellGroupWareSession")    ' login to GW
> > 'Login using () will login to the open account or run the login
Doug Robbins - Word MVP - 02 Jan 2008 21:01 GMT
Save it and then Kill it if you do not want a copy retained.

Signature

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

> The problem is, I don't want them to save it, but send it directly to me.
> I
[quoted text clipped - 23 lines]
>> > Set GWApp = CreateObject("NovellGroupWareSession")    ' login to GW
>> > 'Login using () will login to the open account or run the login
Tony Jollans - 03 Jan 2008 00:24 GMT
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.

Signature

Enjoy,
Tony

> The problem is, I don't want them to save it, but send it directly to me.
> I
[quoted text clipped - 23 lines]
>> > Set GWApp = CreateObject("NovellGroupWareSession")    ' login to GW
>> > 'Login using () will login to the open account or run the login
 
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.