I'm trying to have users click on a Action Button to automatically set the margins in order for a delicate form to print entirely on 1 page.
After hours and hours of effort, I realized I can't get the FULL FILE MENU to appear.
While viewing the doc, I manually do a "ALT+F", and what you get are 19 FILE MENU options. When I try to use my Action Button, the ALT+F script code only produces a subset FILE MENU of about 9 items to choose from, and PAGE SETUP isn't one of them. For some reason it tries to execute the first menu option "MESSAGE" and hangs there.
I'm using IBM DOMINO DESIGNER 9.0 on Windows 10 Enterprise.
I tried this in 2 different ways using keybd_event and SendKeys - the code for both Action Buttons are detailed below.
If anyone can get this to work, I'd appreciate some help. Thank you very much in advance for your time and assistance.
--------------------------------------------------------------------------------------------------------------------------------------------------------------
USING keybd_event:
DECLARATIONS:
Declare Sub keybd_event Lib "user32.dll" (Byval bVk As Integer, Byval bScan As Integer, Byval dwFlags As Integer,Byval dwExtraInfo As Integer)
CLICK:
Sub Click(Source As Button)
keybd_event &h12,0,0,0 ' Alt key down
keybd_event &h46,0,0,0 ' F key down
keybd_event &h46,0,2,0 ' F key up
keybd_event &h12,0,2,0 ' Alt key up
keybd_event &h47,0,0,0 ' G key down
keybd_event &h42,0,2,0 ' G key up
'set Above Header to .25
keybd_event &h6e,0,0,0 ' . key down
keybd_event &h6e,0,2,0 ' . key up
keybd_event &h62,0,0,0 ' 2 key down
keybd_event &h62,0,2,0 ' 2 key up
keybd_event &h65,0,0,0 ' 5 key down
keybd_event &h65,0,2,0 ' 5 key up
'move
keybd_event &h09,0,0,0 ' Tab key down
keybd_event &h09,0,2,0 ' Tab key Up
'set Above Body to .25
keybd_event &h6e,0,0,0 ' . key down
keybd_event &h6e,0,2,0 ' . key up
keybd_event &h62,0,0,0 ' 2 key down
keybd_event &h62,0,2,0 ' 2 key up
keybd_event &h65,0,0,0 ' 5 key down
keybd_event &h65,0,2,0 ' 5 key up
'move
keybd_event &h09,0,0,0 ' Tab key down
keybd_event &h09,0,2,0 ' Tab key Up
'set Below Body to .25
keybd_event &h6e,0,0,0 ' . key down
keybd_event &h6e,0,2,0 ' . key up
keybd_event &h62,0,0,0 ' 2 key down
keybd_event &h62,0,2,0 ' 2 key up
keybd_event &h65,0,0,0 ' 5 key down
keybd_event &h65,0,2,0 ' 5 key up
'move
keybd_event &h09,0,0,0 ' Tab key down
keybd_event &h09,0,2,0 ' Tab key Up
'set Below Footer to .25
keybd_event &h6e,0,0,0 ' . key down
keybd_event &h6e,0,2,0 ' . key up
keybd_event &h62,0,0,0 ' 2 key down
keybd_event &h62,0,2,0 ' 2 key up
keybd_event &h65,0,0,0 ' 5 key down
keybd_event &h65,0,2,0 ' 5 key up
'Enter to close dialog box
keybd_event &h0d,0,0,0 ' Enter key down
keybd_event &h0d,0,2,0 ' Enter key up
End Sub
---------------------------------------------------------------------------------------------------------------------------------------------------------------
USING SENDKEYS:
DECLARATIONS:
Dim WshShell As Variant
Dim i As Integer
CLICK:
Sub Click(Source As Button)
Set WshShell = CreateObject("WScript.Shell")
If (WshShell Is Nothing) Then
Msgbox "Failed to create shell object."
Exit Sub ' EXIT
End If
WshShell.SendKeys "%F", True
WshShell.SendKeys "g"
WshShell.SendKeys "."
WshShell.SendKeys "2"
WshShell.SendKeys "5"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "."
WshShell.SendKeys "2"
WshShell.SendKeys "5"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "."
WshShell.SendKeys "2"
WshShell.SendKeys "5"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "."
WshShell.SendKeys "2"
WshShell.SendKeys "5"
WshShell.SendKeys "{ENTER}" '
End Sub