none
Word submit button options RRS feed

  • Question

  • Hello, please can anyone help me with a step by step setup as how to create a submit button in ms word 2010. it the code , i will like to specify the recipient address and subject.

    Thanks


    sameyaw

    Thursday, October 11, 2012 11:52 AM

Answers

  • Hi sameyaw,

    Thanks for posting in the MSDN Forum.

    Based on your issue,I would suggest you this solution by steps.

    1.Options>>Customize Ribbon>>Select the <Developer> option.

    2.Developer>>Controls>>Click on the Command Button in the Control toolbox toolbar.

    3.Double click on the command button, this will open up the VB editior

    4.Follow up this code

    Private Sub CommandButton1_Click()
    
     ActiveDocument.HasRoutingSlip = True
     With ActiveDocument.RoutingSlip
     .Subject = "Your subject goes here"
     .AddRecipient "Your email address goes here"
     .Delivery = wdAllAtOnce
     End With
     ActiveDocument.Route
    
    End Sub

    Hope this helps.

    Best Regards,


    Leo_Gao [MSFT]
    MSDN Community Support | Feedback to us

    Friday, October 12, 2012 2:05 AM
    Moderator

All replies

  • Hi sameyaw,

    Thanks for posting in the MSDN Forum.

    Based on your issue,I would suggest you this solution by steps.

    1.Options>>Customize Ribbon>>Select the <Developer> option.

    2.Developer>>Controls>>Click on the Command Button in the Control toolbox toolbar.

    3.Double click on the command button, this will open up the VB editior

    4.Follow up this code

    Private Sub CommandButton1_Click()
    
     ActiveDocument.HasRoutingSlip = True
     With ActiveDocument.RoutingSlip
     .Subject = "Your subject goes here"
     .AddRecipient "Your email address goes here"
     .Delivery = wdAllAtOnce
     End With
     ActiveDocument.Route
    
    End Sub

    Hope this helps.

    Best Regards,


    Leo_Gao [MSFT]
    MSDN Community Support | Feedback to us

    Friday, October 12, 2012 2:05 AM
    Moderator
  • Hi Leo, Thanks for your help. I am being a good student. I followed what you gave me

    Private Sub CommandButton1_Click()

    ActiveDocument.HasRoutingSlip = True

    With ActiveDocument.RoutingSlip

    .Subject = "Personal Purchasing Request"

    .AddRecipient "sameyaw@....."

    .Delivery = wdAllAtOnce  

    End With

    End Sub

    ===========

    I did the above but it keeps coming with errors. pleases did I set something incorrect?

    


    sameyaw

    Wednesday, October 17, 2012 3:08 PM
  • Hi sameyaw,

    I'm sorry I forgot that HasRoutingSlip property has been removed from Office 2007. Now please try this code. We are using the Outlook application as object.

    Private Sub CommandButton1_Click()
    Dim olApp As Object
     Dim olMsg As Object
     Set olApp = CreateObject("Outlook.Application")
     Set olMsg = olApp.CreateItem(0)
     With olMsg
     .To = "email address"
     .Subject = "subject"
     .Body = "email body"
     End With
    
     Set olMsg = Nothing
     Set olApp = Nothing
    End Sub
    

    Hope this helps.

    Best Regards,


    Leo_Gao [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, October 18, 2012 2:10 AM
    Moderator
  • Hi Leo,

    thanks for your time and effort. It is working for me. thanks soo much. Please, hmmm! this world one thing leads to the other. Please one more thing. It is possible that;

    1. It will come with a prompt that "Are you sure want to submit"? and when onclick "yes" it sends and the form Vanishes? and when onlick "no" the form stays ?

    Thanks for your time. Hope to hear from your soon.


    sameyaw

    Thursday, October 18, 2012 7:11 PM
  • Leo, I was trying the above code again. I'm using office 2010. When I click on the submit button, I see the Outlook icon right far conner of the task bar which say "Another program is using outlook. To disconnect programs and exit outlook, click the outlook icon and click exit now". When this happens, nothing is sent. Am I doing something wrong ? Wha do you think.

    Thanks

    Sameyaw


    sameyaw

    Friday, October 19, 2012 11:57 AM
  • Hi sameyaw,

    As the message says ,I think it is caused by that Outlook has been opened or used by another application when you click on the submit button. If Outlook is already open then a new instance is created, the user will end up with multiple instances open. Please check and close the Outlook process when run your sending email code in Word.

    Hope it helps.

    Have a nice day.


    Leo_Gao [MSFT]
    MSDN Community Support | Feedback to us

    Monday, October 22, 2012 4:32 AM
    Moderator
  • Leo,

    Thanks for your reply. I can assure you that I even closes all programs and goes to task manager to close all services but I still receive that error message. Please, kindly look into it for me.

    Thanks.


    sameyaw

    Monday, October 22, 2012 11:05 AM
  • sameyaw,

    I cannot reproduce your issue because I have not the same environment as yours, but I found this thread which may have the similar problem with you.

    http://answers.microsoft.com/en-us/office/forum/office_2010-outlook/windows-search-does-not-open-outlook-2010-items-no/f05fcfae-6719-46dc-85bb-0e078b13a515

    Please try the resolution from it.

    Open Regedit:

    Find Key:
    HKEY_CLASSES_ROOT\TypeLib\{00062FFF-0000-0000-C000-000000000046}\9.4\0\win64\

    Change (Default) value from:
    C:\Program Files\Microsoft Office\Office14\msoutl.olb

    To:
    C:\Program Files (x86)\Microsoft Office\Office14\msoutl.olb

    Best Regards,


    Leo_Gao [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, October 23, 2012 1:54 AM
    Moderator
  • Hello Leo,

    When I looked into the above post. But it looks like it is a for 64 bit machines. But in my case, I have 32 bit office and the operating system is 32bit. But the problem still persists. Please can anyone help me with it. I have been making sure that no application is using outlook.

    Thanks


    sameyaw

    Friday, October 26, 2012 8:50 AM
  • HI

    I would like to use this code but not set it to use Outlook, to use their default email app. Is that possible?

    thanks

    Tuesday, June 25, 2013 5:21 PM
  • Hi Leo,

    We use Lotus Notes, how do I make this work with Lotus Notes?

    Wednesday, August 21, 2013 3:40 PM
  • Hi Leo,

    I used this Script for my form. It doesn't seem to do anything... I'm aware that the script is for Outlook 2007.

    I am running Outlook 2010 is there a way I can get this working? I'm also running word 2010

    I modified the script slightly too is there any errors in this:

    Private Sub Submit_Click()
    Dim olApp As Object
     Dim olMsg As Object
     Set olApp = CreateObject("Outlook.Application")
     Set olMsg = olApp.CreateItem(0)
     With olMsg
     .To = "ntaylor@turbopowersystems.com"
     .Subject = "Stakeholder Form"
     .Body = "Test"
     End With
    
     Set olMsg = Nothing
     Set olApp = Nothing
    End Sub
    

    Regards,

    Nathan

    Wednesday, February 19, 2014 11:54 AM