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.

Mailing a saved document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Duffer - 19 Dec 2004 11:27 GMT
I have got some code to save a document and I want to add more to send the
document to a list of recipients. I have tried the routing slip method but
when the code runs, I get multiple instances of a dialog box which state"A
program is trying to access e-mail addresses you have stored in Outlook. Do
you want to allow this."
At this time I am only sending the document to myself (I want it to work
before I enter the real recipeints), and a copy is sent, but how do I prevent
the dialog box from popping up? Here is what I have

Private Sub Document_Close()
 Set myDoc = ActiveDocument
 If myDoc = "Living Unit Report.doc" Then
   FileL = "H:\union\s86506\S86506_PSSG_CB_AdultCustody_FRCC_Shr\Living
Unit Reports\"
   Unit = ActiveDocument.FormFields("DropDown1").Result
   Mnth = ActiveDocument.FormFields("DropDown2").Result
   Dy = ActiveDocument.FormFields("Text7").Result
   Yr = ActiveDocument.FormFields("DropDown3").Result
   FileN = FileL & "LUR" & Yr & Mnth & Dy & Unit & ".doc"
 Else
 GoTo 10
 End If

' Can be used if multiple copies of form are saved in same day
' i = 97
' appen = ""
'   Do While fs.FileExists(FileN) = True
'       appen = Chr(i)
'       FileN = FileL & Tag & Yr & Mnth & Dy & Unit & appen & ".doc"
'       i = i + 1
'   Loop
myDoc.WritePassword = "why"
ActiveDocument.SaveAs FileName:=FileN
ActiveDocument.HasRoutingSlip = True
With ActiveDocument.RoutingSlip
   .Subject = "living unit report"
   .AddRecipient "stuart.davies@gems3.gov.bc.ca"
   .Delivery = wdAllAtOnce
End With
ActiveDocument.Route
10
Application.Quit SaveChanges:=wdPromptToSaveChanges
End Sub

Not too clean, but I am just starting to learn VBA.
Thanking you in advance.
Helmut Weber - 19 Dec 2004 17:17 GMT
Hi Duffer,
have a look at

http://www.contextmagic.com/express-clickyes/

and think twice, before using it.

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
Duffer - 20 Dec 2004 07:23 GMT
Thanks Helmut,
That makes the troublesome dialog box go away, but I don't think it will
solve the problem down the road. When I sent the original post I failed to
mention that I was setting this up for use by others who have little or no
computer knowledge. The process is that they fill out the form and as they
close the form, it saves and e-mails the form to supervisors. There are to be
up to 18 of these forms each day. Is there a simpler way to do this with VBA?
All suggestions are much appreciated.

> Hi Duffer,
> have a look at
[quoted text clipped - 8 lines]
> Word XP, Win 98
> http://word.mvps.org/
Doug Robbins - Word MVP - 20 Dec 2004 12:25 GMT
See the article “How to send an email from Word using VBA” at:

http://word.mvps.org/FAQs/InterDev/SendMail.htm

Signature

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested.  Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP

> Thanks Helmut,
> That makes the troublesome dialog box go away, but I don't think it will
[quoted text clipped - 17 lines]
> > Word XP, Win 98
> > http://word.mvps.org/
Duffer - 21 Dec 2004 08:07 GMT
Thanks Doug,
I saw your previous response to a post and have checked out and used the
link you provided. I incorporated the .Routing code in my code, but ran into
the Dialog box problem. Helmut's suggested link is useful as well, but as I
wrote, the fininshed form will be used by new users who are just learning to
save to folders and not necessarily the right drive let alone folder (which
is why I have the code running on close of document). I will have to get
further direction from my supervisors as to how they want this to work.
Perhaps the easiest solution is to have the supervisors sent the forms once
all are completed.
PS: I don't have administrative privileges on the system we are using so
can't set references other than on my profile...
Thanks again for the help.

> See the article “How to send an email from Word using VBA” at:
>
[quoted text clipped - 23 lines]
> > > Word XP, Win 98
> > > http://word.mvps.org/
 
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.