Results 1 to 11 of 11
  1. #1
    redekopp is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2015
    Location
    Saskatoon
    Posts
    108

    Calling the on screen keyboard

    I am looking to call the on-screen keyboard of a Windows 10 device. Running access 2016.


    I have tried those shell commands but they always result in the error:

    Run-time error '5':


    Invalid procedure call or argument


    here is two of what I have tried:
    Code:
    Dim stappname As String
    
        stappname = "osk.exe"
        Call Shell(stappname, 1)

    Code:
    Shell "C:\Windows\System32\osk.exe"
    Thanks!

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    This one took me way off into heretofore uncharted territory! I ended up doing a search on other folders and found the following:

    This works - altho gives an additional security window, ok to open:
    Code:
        Application.FollowHyperlink "C:\Windows\WinSxS\amd64_microsoft-windows-osk_31bf3856ad364e35_10.0.10586.0_none_37426bc50445e4b2\osk.exe"
    So does this, with no additional clicks:
    Code:
    Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _
        ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, _
        ByVal lpDirectory As String, ByVal lpnShowCmd As Long) As Long
    Public Sub ShellEx()
    
        ShellExecute hWndAccessApp, "open", "C:\Windows\WinSxS\amd64_microsoft-windows-osk_31bf3856ad364e35_10.0.10586.0_none_37426bc50445e4b2\osk.exe", 0, 0, 1
    
    End Sub
    Last edited by aytee111; 05-25-2017 at 09:54 AM. Reason: further clarification

  3. #3
    redekopp is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2015
    Location
    Saskatoon
    Posts
    108
    I tried your top one, I had an annoying dialogue box that came up warning me about opening the keyboard, then after hitting open it says could not start the on-screen keyboard. If I put the path into normal windows search it opens fine, so not sure what the issue is.

    Your second one I will look into, not sure where I put that declare function part. will google.

    Edit: Tried the second one, it says that it expected a variable or procedure, not a function. I may have placed it wrong. I made the function into a module?

    Thanks

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    That code goes at the very top, after Option Explicit, in a global module.

  5. #5
    redekopp is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2015
    Location
    Saskatoon
    Posts
    108
    I made a module called ShellExecute with the function code in it like so:
    Code:
    Option Explicit
    
    Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _
        ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, _
        ByVal lpDirectory As String, ByVal lpnShowCmd As Long) As Long
    I then made my on-click event for the keyboard button with the following code:
    Code:
    Private Sub keyboard_Click()
    
        
    DoCmd.SetWarnings False
    
    
    ShellExecute hWndAccessApp, "open", "C:\Windows\System32\osk.exe", 0, 0, 1
    
    
    'Shell "C:\Windows\System32\osk.exe"
    DoCmd.SetWarnings True
    
    
    End Sub
    It gives an error saying it expected a variable or procedure, not a module. Highlighting "ShellExecute"

  6. #6
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Couldn't get that to work either.

  7. #7
    redekopp is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2015
    Location
    Saskatoon
    Posts
    108
    well darn.

  8. #8
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Did neither of those in post #2 work for you? Do those paths exist?

  9. #9
    redekopp is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2015
    Location
    Saskatoon
    Posts
    108
    those paths didnt exist on my device, but i substituted for my device. no bueno

  10. #10
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Do what I did then, search for an alternate.

  11. #11
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    PMFJI,

    Quote Originally Posted by redekopp View Post
    I made a module called ShellExecute with the function code in it like so:
    Private Sub keyboard_Click()


    DoCmd.SetWarnings False


    ShellExecute hWndAccessApp, "open", "C:\Windows\System32\osk.exe", 0, 0, 1
    <snip>

    [/code]

    It gives an error saying it expected a variable or procedure, not a module. Highlighting "ShellExecute"
    Try changing the name of the module.
    Its my understanding you can't name a module the same name as a function.

    Try naming the module "Module100" or "modShellExecute"

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 04-29-2017, 12:09 PM
  2. Best screen resultion for most common screen sizes
    By sjs94704 in forum Database Design
    Replies: 3
    Last Post: 05-26-2015, 06:12 AM
  3. Keyboard Shortcuts
    By emberk in forum Access
    Replies: 1
    Last Post: 05-27-2014, 05:47 PM
  4. Keyboard shortcuts for checkbox
    By Lowell in forum Access
    Replies: 1
    Last Post: 04-14-2012, 10:37 AM
  5. Replies: 11
    Last Post: 06-05-2011, 09:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums