View Full Version : Solved: Open Ms On Screen Keyboard
softman
10-06-2010, 06:46 AM
I would like to know if it's possible to open the MS On screen keyboard via a VBA code.I have tried this bus it does not work:Sub OnScreenkeyboard() On Error Resume Next AppVal = Shell("%windir%\system32\osk.exe", 1)If Err 0 Then MsgBox "Can't start the application.", vbCritical, "Error" End IfEnd SubMany thanks
RonMcK
10-06-2010, 07:13 AM
Softman,
Your code will be easier to read if you click the VBA button above the message entry box before you paste your code in into your message. This will generate the tags: , then put your cursor between then and insert your code. It should come out looking like this:
Sub OnScreenkeyboard()
On Error Resume Next
AppVal = Shell("%windir%\system32\osk.exe", 1)
If Err 0 Then ' << there is an vba error here, do you need an = sign between Err and 0?
MsgBox "Can't start the application.", vbCritical, "Error"
End If
End Sub
Cheers,
nepotist
10-06-2010, 07:14 AM
Sub OnScreenkeyboard()
Dim Apath As String
Apath = "C:\Windows\system32\osk.exe"
FollowHyperlink Apath
End Sub
I am not sure why the shell function isnt working , but this a workaround
softman
10-06-2010, 07:28 AM
nepotist, I am still getting error "can not open specified fiel"
For some reason my VBA did not work, sorry
nepotist
10-06-2010, 07:38 AM
What is the error?
Recheck the path for your windows directory..It worked for me or repost you code
softman
10-06-2010, 07:58 AM
can not open specified file - I will try this tonight on another machine
slamet Harto
10-06-2010, 08:07 PM
Hi guys
This is from Simon code
Private 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 nShowCmd As Long) As Long
Sub Launch_It()
ShellExecute 0, vbNullString, "osk.exe", vbNullString, "C:\", 1
End Sub
hope this help
softman
10-13-2010, 11:16 PM
Works like a bomb! Many thanks
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.