vba Change Keyboard Language!

Bib195

New Member
Joined
Dec 14, 2024
Messages
21
Office Version
  1. 365
Platform
  1. Windows
Dear Gurus & vba Masters,
I have a case were I wrote some code to automatically send WhatsApp messages to selected contacts. My problem is that if the Keyboard language is Arabic, WhatsApp doesn't respond properly to the send Key statement.
The Million Dollar question: { Is there a way for vba to Change the Keyboard Language from Arabic (Saudi Arabia) to English (United State) and via versa.?
I appreciate everybody's input as usual and Thank you all in Advance for the help I received for the past few weeks.
Cheers,
Ehab
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi,
As long as no one replied to my above question, I had to search in several places and I found what I was looking for.
Below is the solution if it might help someone else....
Thanks to everybody.
==================
Private Declare Function ActivateKeyboardLayout Lib _
"user32.dll" (ByVal myLanguage As Long, Flag As Boolean) As Long

Private Const ar = 1025 'Arabic (Saudi Arabia) keyboard language layout
Private Const eng = 1033 'English(united states) keyboard language layout

Private Sub A_Enter()
Call ActivateKeyboardLayout(ar, 0)
End Sub

Private Sub A_Exit(Cancel As Integer)
Call ActivateKeyboardLayout(eng, 0)
End Sub
============================================
 
Upvote 0

Forum statistics

Threads
1,226,013
Messages
6,188,421
Members
453,473
Latest member
bbugs73

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top