Subject: Programatically open attachment in edit mode
make an action or a button with the following code:
Open the doc in UI Mode.
go to the RT field were the attachment resides.
then press the button/action:
'-----------------------------------------------------
Type KBDINPUT ’ INPUT structure
wVk As Integer ' must be 1 for kbd
wScan As Integer ' VKey code
dwFlags As Long ' we don't use this
iTime As Long ' don't use this
dwExtraInfo As Long ' or this
End Type
Dim Kinput As KBDINPUT
Type GeneralInput
dwType As Long
xi(0 To 23) As Byte
End Type
Dim Ginput(0 To 1) As GeneralInput
Const INPUT_KYBOARD = 1
Const KEYEVENTF_KEYUP = &H2
Const VK_CONTROL = &H11
Const VK_MENU = &H12 ’ the ALT key
Const VK_T = &H54
Const VK_TAB = &H09
Const VK_RETURN = &H0D
Declare Sub keybd_event Lib “user32” (Byval bVk As Byte, Byval bScan As Byte, Byval dwFlags As Long, Byval dwExtraInfo As Long)
'-------------------------------------------
Sub Click(Source As Button)
'open in ui mode
'goto to your attachment
'then fire the code below
Call keybd_event(VK_MENU,0,0,0) ' press the ALT key
Call keybd_event(VK_T,0,0,0) ' fire the T key
Call keybd_event(VK_T,0,KEYEVENTF_KEYUP,0) ' let up the T key
Call keybd_event(VK_MENU,0,KEYEVENTF_KEYUP,0) ' let up the ALT key
Call keybd_event(VK_RETURN,0,0,0) ' fire the RETURN key
Call keybd_event(VK_RETURN,0,KEYEVENTF_KEYUP,0) ' let up the RETURN key
Call keybd_event(VK_TAB,0,0,0) ' fire the TAB key
Call keybd_event(VK_TAB,0,KEYEVENTF_KEYUP,0) ' let up the TAB key
Call keybd_event(VK_TAB,0,0,0) ' fire the TAB key
Call keybd_event(VK_TAB,0,KEYEVENTF_KEYUP,0) ' let up the TAB key
Call keybd_event(VK_RETURN,0,0,0) ' fire the RETURN key
Call keybd_event(VK_RETURN,0,KEYEVENTF_KEYUP,0) ' let up the RETURN key
End Sub
'all done