cancel
Showing results for 
Search instead for 
Did you mean: 

Script pauses when windows dialog box asks for file save location...

Former Member
0 Kudos

Whenever i attempt to export a report from SAP to excel using VBA the script pauses because a windows dialog box opens that prompts the user to select a file name and location...As a work around to this issue i would like to select the columns, copy and paste them into excel.  I have been successful in selecting all the columns


with session.

    .findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectColumn "EBELP"

    .findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectColumn "BSART"

    .findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectColumn "WERKS"

    .findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectColumn "MATNR"

    .findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectColumn "TXZ01"

    .findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectColumn "BEDNR"

    .findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectColumn "AUFNR"

    .findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectColumn "NAME1"

    .findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectColumn "PMATN"

    .findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectColumn "AEDAT"

    .findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectColumn "ZSLFDT"

    .findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectColumn "MENGE"

    .findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectColumn "NETPR"

    .findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectColumn "STPRS"

    .findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectColumn "ZWEMNG"

end with

However, i cannot find the vkey to copy the data.  Can anybody help?

Accepted Solutions (1)

Accepted Solutions (1)

former_member213011
Participant
0 Kudos

Perhaps sendvkey 78

From the SAP Scripting API:

Possible values for the VKey parameter can be found in the table GUI_FKEY.

VKeyKeyboard Combination
00Enter
01F1
02F2
03F3
04F4
05F5
06F6
07F7
08F8
09F9
10F10
11Ctrl+S
12F12
13Shift+F1
14Shift+F2
15Shift+F3
16Shift+F4
17Shift+F5
18Shift+F6
19Shift+F7
20Shift+F8
21Shift+F9
22Shift+Ctrl+0
23Shift+F11
24Shift+F12
25Ctrl+F1
26Ctrl+F2
27Ctrl+F3
28Ctrl+F4
29Ctrl+F5
30Ctrl+F6
31Ctrl+F7
32Ctrl+F8
33Ctrl+F9
34Ctrl+F10
35Ctrl+F11
36Ctrl+F12
37Ctrl+Shift+F1
38Ctrl+Shift+F2
39Ctrl+Shift+F3
40Ctrl+Shift+F4
41Ctrl+Shift+F5
42Ctrl+Shift+F6
43Ctrl+Shift+F7
44Ctrl+Shift+F8
45Ctrl+Shift+F9
46Ctrl+Shift+F10
47Ctrl+Shift+F11
48Ctrl+Shift+F12
70Ctrl+E
71Ctrl+F
72Ctrl+/
73Ctrl+\
74Ctrl+N
75Ctrl+O
76Ctrl+X
77Ctrl+C
78Ctrl+V
79Ctrl+Z
80Ctrl+PageUp
81PageUp
82PageDown
83Ctrl+PageDown
84Ctrl+G
85Ctrl+R
86Ctrl+P

Thanks

Sayuti

Former Member
0 Kudos

Well, thats awesome but it didnt help.  VBA returned, "...VKEY not enabled..." however.  I copied/pasted the data as follows


session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").contextMenu

session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectContextMenuItemByPosition "0"

Answers (0)