none
Sendkeys are not executed! RRS feed

  • Question

  • Hello,

    i use this script but whatever i try the sendkeys arent executed - only the website is openend - i want to create  a new email before!

    Sub test()

    SendKeys "^+m{TAB 4}" Sleep (10000) Call ShellExecute(0, "open", "https://global.gotomeeting.com", "", "", SW_MAXIMIZE)

    end sub()

    thank you!

    Martin

    Thursday, January 4, 2018 10:36 AM

Answers

  • yes i want to move - that works perfect - but in the body i want to insert a autotext (i dont know the english word) - a kind of quick part - 

    Sub Gotomeeting()

    Dim mail As MailItem
    Set mail = Application.CreateItem(olMailItem)
    mail.Subject = "Onlineberatung" '
    mail.Body = "Gotomeeting" 'this ist the name of the autotext
    SendKeys "{F3}", True 
    mail.To = "" 'set cursor to adress
    mail.Display

    End Sub

    The pproblem is, the auto.tect is not inserted with the F3 comman.

    Can someone help

    thank you

    • Marked as answer by krugi Monday, January 8, 2018 4:48 PM
    Friday, January 5, 2018 8:52 AM

All replies

  • SendKeys is not as easy to use as you think. You must ensure that the destination control has the focus. You might be able to access the HTML and use the DOM to do what you need to do but that is also not as easy as you think. Chances are you need to use the traditional way to create an email message and send it.


    Sam Hobbs
    SimpleSamples.Info

    Thursday, January 4, 2018 9:54 PM
  • Hello krugi,

    As Sam said, we would suggest you create a mail in normal way.

    Here is a simply code to create a mail in Outlook.

    Dim mail As MailItem
    Set mail = Application.CreateItem(olMailItem)
    mail.Display

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, January 5, 2018 2:58 AM
  • thank you-perfect - that works, but can i afterwards move to the body or subject  with a command instead of sendkeys. or put directly a quick part in the body with command?
    Friday, January 5, 2018 7:28 AM
  • Hello krugi,

    What do you want to do with the mail? Why do you need move to the body or subject with a command? 

    If you want to edit the mail's subject or body, we could edit the Mailitem object directly.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, January 5, 2018 8:16 AM
  • yes i want to move - that works perfect - but in the body i want to insert a autotext (i dont know the english word) - a kind of quick part - 

    Sub Gotomeeting()

    Dim mail As MailItem
    Set mail = Application.CreateItem(olMailItem)
    mail.Subject = "Onlineberatung" '
    mail.Body = "Gotomeeting" 'this ist the name of the autotext
    SendKeys "{F3}", True 
    mail.To = "" 'set cursor to adress
    mail.Display

    End Sub

    The pproblem is, the auto.tect is not inserted with the F3 comman.

    Can someone help

    thank you

    • Marked as answer by krugi Monday, January 8, 2018 4:48 PM
    Friday, January 5, 2018 8:52 AM