ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing control Panel options (https://www.excelbanter.com/excel-programming/419088-changing-control-panel-options.html)

Art

Changing control Panel options
 
Hello:

I was wondering how I can write a VBA code that will allow me to change the
mouse options in the control panel that switches primary and secondary
buttons. How can I access the control panel from excel? Please let me know.

Thanks.

Peter T

Changing control Panel options
 
Private Declare Function SwapMouseButton Lib "user32" (ByVal _
bSwap As Long) As Long

Function DefMouseButton(Optional nButton As Long = 0)

DefMouseButton = SwapMouseButton(nButton)
End Function


DefMouseButton 1& ' right
DefMouseButton 0 ' left


Regards,
Peter T

"art" wrote in message
...
Hello:

I was wondering how I can write a VBA code that will allow me to change
the
mouse options in the control panel that switches primary and secondary
buttons. How can I access the control panel from excel? Please let me
know.

Thanks.




Peter T

Changing control Panel options
 
Function DefMouseButton(Optional nButton As Long = 0)

better as

Function DefMouseButton(Optional nButton As Long = 0) As Long

Peter T

"Peter T" <peter_t@discussions wrote in message
...
Private Declare Function SwapMouseButton Lib "user32" (ByVal _
bSwap As Long) As Long

Function DefMouseButton(Optional nButton As Long = 0)

DefMouseButton = SwapMouseButton(nButton)
End Function


DefMouseButton 1& ' right
DefMouseButton 0 ' left


Regards,
Peter T

"art" wrote in message
...
Hello:

I was wondering how I can write a VBA code that will allow me to change
the
mouse options in the control panel that switches primary and secondary
buttons. How can I access the control panel from excel? Please let me
know.

Thanks.






Art

Changing control Panel options
 
Thanks. What I wanted was the window "C:\Windows\system32\main.cpl" that is
the mouse option window to display. Can you tell me how to write that.

"Peter T" wrote:

Private Declare Function SwapMouseButton Lib "user32" (ByVal _
bSwap As Long) As Long

Function DefMouseButton(Optional nButton As Long = 0)

DefMouseButton = SwapMouseButton(nButton)
End Function


DefMouseButton 1& ' right
DefMouseButton 0 ' left


Regards,
Peter T

"art" wrote in message
...
Hello:

I was wondering how I can write a VBA code that will allow me to change
the
mouse options in the control panel that switches primary and secondary
buttons. How can I access the control panel from excel? Please let me
know.

Thanks.





Art

Changing control Panel options
 
Thanks, I got already what I wanted:

Sub OPenMousenow()
Set ShellApp = CreateObject("Shell.Application")
ShellApp.ControlPanelItem ("C:\Windows\system32\main.cpl")
End Sub





Thanks Anyways.

"Peter T" wrote:

Function DefMouseButton(Optional nButton As Long = 0)


better as

Function DefMouseButton(Optional nButton As Long = 0) As Long

Peter T

"Peter T" <peter_t@discussions wrote in message
...
Private Declare Function SwapMouseButton Lib "user32" (ByVal _
bSwap As Long) As Long

Function DefMouseButton(Optional nButton As Long = 0)

DefMouseButton = SwapMouseButton(nButton)
End Function


DefMouseButton 1& ' right
DefMouseButton 0 ' left


Regards,
Peter T

"art" wrote in message
...
Hello:

I was wondering how I can write a VBA code that will allow me to change
the
mouse options in the control panel that switches primary and secondary
buttons. How can I access the control panel from excel? Please let me
know.

Thanks.







Peter T

Changing control Panel options
 
Call Shell("rundll32.exe shell32.dll,Control_RunDLL main.cpl @0",
vbNormalFocus)

Regards,
Peter T

"art" wrote in message
...
Thanks. What I wanted was the window "C:\Windows\system32\main.cpl" that
is
the mouse option window to display. Can you tell me how to write that.

"Peter T" wrote:

Private Declare Function SwapMouseButton Lib "user32" (ByVal _
bSwap As Long) As Long

Function DefMouseButton(Optional nButton As Long = 0)

DefMouseButton = SwapMouseButton(nButton)
End Function


DefMouseButton 1& ' right
DefMouseButton 0 ' left


Regards,
Peter T

"art" wrote in message
...
Hello:

I was wondering how I can write a VBA code that will allow me to change
the
mouse options in the control panel that switches primary and secondary
buttons. How can I access the control panel from excel? Please let me
know.

Thanks.








All times are GMT +1. The time now is 08:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com