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 / Publisher / Programming / October 2005

Tip: Looking for answers? Try searching our database.

sending e-mail thru user form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alex - 04 Oct 2005 19:25 GMT
On a page I have an e-mail info@website.com with hyperlink. But, I'd like to
give the user the opportunity to do the same thru a form.
I've created a userform with text boxes where the user can enter his/her
name, subject, and message then click button and send this message to the web
site (to info@website.com ).
How could I implement it thru VB?
I'm thinking about approx. the following code. But, in this code should I
know what e-mail program the user has on his computer or it will be the
server (website hosting) e-mail program and I shouldn't care about the user
e-mail program?

   Dim OutApp As Object
   Dim OutMail As Object

   Set OutApp = GetObject(, "Outlook.Application")
   If Err <> 0 Then
       'Outlook wasn't running, start it from code
       Set OutApp = CreateObject("Outlook.Application")
       bStarted = True
   End If
   Set OutMail = OutApp.CreateItem(0)
.....
On Error Resume Next
   With OutMail
       .To = …
       .CC = …
       .Subject = …
       .Body = …
       .Send

   End With
....
Or I can use something else?

Thanks
Ed Bennett - 05 Oct 2005 22:12 GMT
Alex <Alex@discussions.microsoft.com> was very recently heard to utter:
> On a page I have an e-mail info@website.com with hyperlink. But, I'd
> like to give the user the opportunity to do the same thru a form.
> I've created a userform with text boxes where the user can enter
> his/her name, subject, and message then click button and send this
> message to the web site (to info@website.com ).
> How could I implement it thru VB?

Are you exporting the publication to a web page to get the links to be
active?  If you are, no VB code will transfer.
Most users will want to use their own email client, really.

> I'm thinking about approx. the following code. But, in this code
> should I know what e-mail program the user has on his computer or it
> will be the server (website hosting) e-mail program and I shouldn't
> care about the user e-mail program?

If you use the code you mentioned, it will require Outlook.  There is code
available by searching Google that allows you to send email from any VB
application.  This, however, would not be appropriate in this instance.

Signature

Ed Bennett - MVP Microsoft Publisher

Zack Barresse - 06 Oct 2005 19:34 GMT
I'm very confused as to why you actually want to use a varible twice to set
it two different times..  Makes no sense to me.  Are you wanting to use
Early or Late binding?  You're showing signs of both.  And as for what Ed
mentions, you do need to know what email app your clients are using.  An
example of what you could use if you didn't know, is shown here ...

Word: http://vbaexpress.com/kb/getarticle.php?kb_id=310
Excel: http://vbaexpress.com/kb/getarticle.php?kb_id=311

The only difference being in the bottom portion of the code ...

Sub eMailActiveDocument()
   Dim Doc As Document

   Application.ScreenUpdating = False
   Set Doc = ActiveDocument
   Doc.Save

   SendIt "me@here.com", "A new Document", "Hi, read this:", Doc.FullName

   Application.ScreenUpdating = True
   Set Doc = Nothing
End Sub.. and ..
Sub eMailActiveWorkbook()
   Dim Wb As Workbook

   Application.ScreenUpdating = False
   Set Wb = ActiveWorkbook
   Wb.Save

   SendIt "me@here.com", "A new Document", "Hi, read this:", Wb.FullName

   Application.ScreenUpdating = True
   Set Wb = Nothing
End SubI believe the Word code should work for you in Publisher.  (Ed,
please correct me if I'm wrong.)

HTH

Signature

Regards,
Zack Barresse, aka firefytr, (GT = TFS FF Zack)

> On a page I have an e-mail info@website.com with hyperlink. But, I'd like
> to
[quoted text clipped - 34 lines]
>
> Thanks
Ed Bennett - 06 Oct 2005 21:40 GMT
> And as for what Ed mentions, you do need to know what email app your
> clients are using.

You can send email from a program without calling any external email
program.  It's been a while since I've done it, but it's definitely
possible.

Signature

Ed Bennett - MVP Microsoft Publisher

Zack Barresse - 06 Oct 2005 21:52 GMT
Right.  The links I posted are mailing without any email program using MAPI.
Personally, I make sure all my clients use Outlook and always use Late
Binding.  It's just more trouble free that way, imho.

Hope all has been well with you Ed.

Signature

Regards,
Zack Barresse, aka firefytr, (GT = TFS FF Zack)

>> And as for what Ed mentions, you do need to know what email app your
>> clients are using.
>
> You can send email from a program without calling any external email
> program.  It's been a while since I've done it, but it's definitely
> possible.
 
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.