vb 6 and outlook

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • keithsimpson3973
    New Member
    • Aug 2006
    • 63

    vb 6 and outlook

    Happy Holidays to everyone.

    I have a vb 6 application with Access 2003. What I am trying to do is, when a user submits the form he fills out for approval, vb 6 opens outlook and puts the subject and body in. Here is the code
    Code:
    ShellExecute Me.hwnd, vbNullString, "mailto:keithsimpson3973@earthlink.net?Subject=A Scheduling Request Document # " & Doc_ID & " needs your attention&Body=Please go to the AAGTC_Scheduling program and review the document for approval. You may also click here to go there now: ", _
     vbNullString, "C:\", SW_SHOWNORMAL
    I would like the
    Code:
    click here
    words or just the here word to act as a hyperlink and open the application to review the doc.

    Thanks
  • willakawill
    Top Contributor
    • Oct 2006
    • 1646

    #2
    Originally posted by keithsimpson397 3
    Happy Holidays to everyone.

    I have a vb 6 application with Access 2003. What I am trying to do is, when a user submits the form he fills out for approval, vb 6 opens outlook and puts the subject and body in. Here is the code
    Code:
    ShellExecute Me.hwnd, vbNullString, "mailto:keithsimpson3973@earthlink.net?Subject=A Scheduling Request Document # " & Doc_ID & " needs your attention&Body=Please go to the AAGTC_Scheduling program and review the document for approval. You may also click here to go there now: ", _
     vbNullString, "C:\", SW_SHOWNORMAL
    I would like the
    Code:
    click here
    words or just the here word to act as a hyperlink and open the application to review the doc.

    Thanks
    Hi Keith,
    Maybe you could consider using automation in your code to run outlook and select html for the body text

    Comment

    • keithsimpson3973
      New Member
      • Aug 2006
      • 63

      #3
      Thanks WillakaWill. I am not quite sure how to go about that one. It sounds good, especially coming from you and Killer42. You guys are awesome. I will do my homework and see if I can figure it out!
      Thanks for the idea.

      Comment

      • keithsimpson3973
        New Member
        • Aug 2006
        • 63

        #4
        Here is what I got so far:

        Code:
        Sub Senmail()
        Dim objOutlook As Object
        Dim objOutlookMsg As Object
        Set objOutlook = CreateObject("Outlook.Application")
        Set objOutlookMsg = objOutlook.CreateItem(0)
        With objOutlookMsg
           .To = "keithsimpson3973@earthlink.net"
           .CC = "name@email.com"
           .Subject = "A scheduling request document # " & Doc_ID & "needs your attention."
           '.Body = "This is the body of message"
           .HTMLBody = <Body>"Please go to the " AAGTC_Scheduling.NavigateTo("AAGTC_Scheduling", "C:\program files\autocad 2002",  "application to review the document.", vbNullString, "C:\", SW_SHOWNORMAL"
           .Attachments.Add ("f:\Test.txt")
           .Send 'Let´s go!
        End With
        Set objOutlookMsg = Nothing
        Set objOutlook = Nothing
        End Sub

        Comment

        • keithsimpson3973
          New Member
          • Aug 2006
          • 63

          #5
          Well, as usual, the advice given me here in this forum, works great. Thanks Will. My app now sends an email to the designated parties, but I still can't find a way to put a link in the body of the Outlook email I send out that will open an application installed on their machines. I tried the HTML AHREF, but it only seems to work for URL's. But I will keep trying and if I get it, I will post back in case someone else ever runs into this.

          Happy Holidays to all the great people here!

          Comment

          • willakawill
            Top Contributor
            • Oct 2006
            • 1646

            #6
            Originally posted by keithsimpson397 3
            Well, as usual, the advice given me here in this forum, works great. Thanks Will. My app now sends an email to the designated parties, but I still can't find a way to put a link in the body of the Outlook email I send out that will open an application installed on their machines. I tried the HTML AHREF, but it only seems to work for URL's. But I will keep trying and if I get it, I will post back in case someone else ever runs into this.

            Happy Holidays to all the great people here!
            Well there are 2 things about links. Firstly you cannot open exe files with a link. That is to protect you from those characters who wish to do damage to your computer via the internet. Secondly you need to know the whereabouts of the file you are sending in order to open it from a link. You are not likely to ever know that and it will be different for each person. they can double click on the attachment.

            Comment

            • keithsimpson3973
              New Member
              • Aug 2006
              • 63

              #7
              Once again, thank you Will. I kinda harbored the thought of the security issue and now hearing it from someone with your knowledge of the subject definitely confirms it. I am not really trying to send any kind of attachment though. The only reason I thought it might work was because I was sending them an email with some type of a link that would just open the application I wrote and installed on their computer. The file they would look at is stored on the LAN. They would click on the link in the body of the email which would be a shell command to lauch the program installed on the computer. Then they would input the doc number that I send in the subject line to open the file and electronically sign off on the file. The file only sits on the LAN and is never "sent" anywhere.

              Example:

              The user starts the scheduling program and inputs all of the information of the unit requesting range time. The user would then click on a control on the form of the scheduling application. That control takes the Document ID field number and inserts it into the email subject line and then sends to 3 people. I have all that working. Then, what I wanted to do (but I understand now that you can't) was just have a line of text in the body of the email with a link (like the shell function) that they would click to start the scheduling application that I built, then they could search by document id and electonically sign the form.

              It was a nice thought, but I guess they will just have start the application manually and inoput the document id.

              Thanks for the help and great advice.

              Comment

              • willakawill
                Top Contributor
                • Oct 2006
                • 1646

                #8
                Originally posted by keithsimpson397 3
                Once again, thank you Will. I kinda harbored the thought of the security issue and now hearing it from someone with your knowledge of the subject definitely confirms it. I am not really trying to send any kind of attachment though. The only reason I thought it might work was because I was sending them an email with some type of a link that would just open the application I wrote and installed on their computer. The file they would look at is stored on the LAN. They would click on the link in the body of the email which would be a shell command to lauch the program installed on the computer. Then they would input the doc number that I send in the subject line to open the file and electronically sign off on the file. The file only sits on the LAN and is never "sent" anywhere.

                Example:

                The user starts the scheduling program and inputs all of the information of the unit requesting range time. The user would then click on a control on the form of the scheduling application. That control takes the Document ID field number and inserts it into the email subject line and then sends to 3 people. I have all that working. Then, what I wanted to do (but I understand now that you can't) was just have a line of text in the body of the email with a link (like the shell function) that they would click to start the scheduling application that I built, then they could search by document id and electonically sign the form.

                It was a nice thought, but I guess they will just have start the application manually and inoput the document id.

                Thanks for the help and great advice.
                It will work if you know where the file is. The html link will open the file in the default app for that file type. no problem

                Comment

                • keithsimpson3973
                  New Member
                  • Aug 2006
                  • 63

                  #9
                  Will,
                  I am a real dummy. I now realize what I was doing wrong after your last post. I was pointing the link at the exe of the app instead of the file itself. I am really sorry. Hope I did not cause you too much trouble! Thanks a million for the help. Happy Holidays!

                  Comment

                  • keithsimpson3973
                    New Member
                    • Aug 2006
                    • 63

                    #10
                    VB 6 and Outlook

                    Help! I have my code with the href, but now it opens internet explorer which then tries to open the access mdb file and of course it can't so I get page not found error. Here is the code I am using to send an HTML format email:

                    Code:
                    Dim objOutlook As Object
                    Dim objOutlookMsg As Object
                    Set objOutlook = CreateObject("Outlook.Application")
                    Set objOutlookMsg = objOutlook.CreateItem(0)
                    With objOutlookMsg
                       .To = "keithsimpson3973@earthlink.net"
                       '.CC = "name@email.com"
                       .Subject = "Scheduling request"
                       '.Body = "A scheduling request with document # " & Doc_ID & " needs your attention. Please log on to the AAGTC_Scheduling application to view this document ASAP! Thank you and have a nice day!"
                       .HTMLBody = "A scheduling request with document # " & Doc_ID & " needs your attention. Please log on to the " & "<" & "A " & "HREF=AAGTC_Scheduling.mdb" & ">" & "RangeSchedule" & "<" & "/" & "A" & ">" & " " & "application to view this document ASAP! Thank you and have a nice day!"
                       '.Attachments.Add ("f:\Test.txt")
                       .Send 'Let´s go!
                    End With
                    Set objOutlookMsg = Nothing
                    Set objOutlook = Nothing
                    Last edited by keithsimpson3973; Dec 11 '06, 02:44 PM. Reason: New Problem with existing thread

                    Comment

                    Working...