I wanted to block the orientation of the screen on the tablet using the excel macro. It worked. But when I returned to the computer, he sent me:
"I can not find the entry point of the SetDisplayAutoRotationPreferences DLL in user32."
The code used to lock the screen orientation is as follows:
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 is no SetDisplayAutoRotationPreferences function on Windows computers.
Is there a way to determine if the device on which the macro is running is a tablet or not? Or perhaps to avoid a DLL entry point error?
The computer OS is Windows 7 and it uses excel 10 '.