I wanted to lock screen orientation on a tablet with an excel macro. It worked.
But when I went back to the computer, it sent me :
"Cant find DLL entry point SetDisplayAutoRotationPreferences in user32".
The code used to lock the screenb orientation is the following :
Enum ORIENTATION_PREFERENCE
ORIENTATION_PREFERENCE_NONE = 0
ORIENTATION_PREFERENCE_LANDSCAPE = 1
ORIENTATION_PREFERENCE_PORTRAIT = 2
ORIENTATION_PREFERENCE_LANDSCAPE_FLIPPED = 4
ORIENTATION_PREFERENCE_PORTRAIT_FLIPPED = 8
End Enum
Private Declare Function SetDisplayAutoRotationPreferences Lib "user32" (ByVal ORIENTATION_PREFERENCE As Long) As Long
Sub RotateToLandscape()
Dim lngRet As Long
lngRet = SetDisplayAutoRotationPreference (ORIENTATION_PREFERENCE_LANDSCAPE)
End Sub
The reason it doesn't work on computers is because there's noth the SetDisplayAutoRotationPreferences function on Windows computers.
Is there any way to determine wheter the device the macro run on is a tablet or not? Or maybe to avoid the DLL entry point error?
The computer's OS is Windows 7 and it uses excel 10'.