Code: Select all
VBSTART
Dim xlApp
Dim xlBook
'Opens the Excel file in Excel
Sub OpenExcelFile(filename)
Set xlApp = CreateObject("Excel.Application")
xlApp.visible = true
Set xlBook = xlApp.Workbooks.open(filename,,False,,,123)
end sub
VBEND
Let>GFL_TYPE=0
Let>GFL_SORTTYPE=1
IfFileExists>Z:\Обмен\ЗАЯВКИ\ЗАЯВКИ в поставку\ОТЕЧ\2021\*.*
GetFileList>Z:\Обмен\ЗАЯВКИ\ЗАЯВКИ в поставку\ОТЕЧ\2021\*.*,files,;
Separate>files,;,file_names
MessageModal>Num Files: %file_names_count%
Let>k=0
Repeat>k
Let>k=k+1
Executefile>file_names_%k%
//Message>file_names_%k%2
//wait>15
//Extract the file name from the entire path/filename
ExtractFileName>file_names_%k%,oldfilename,1
Let>WF_TYPE=2
WaitWindowOpen>%oldfilename% - Excel
Let>regPath=Z:\Обмен\ЗАЯВКИ\Архив\Реестр\Реестр отеч.xlsx
XLOpen>regPath,1,xlBook
Let>WF_TYPE=2
WaitWindowOpen>Реестр отеч - Excel
Let>k1=0
Label>scan
Let>k1=k1+1
DDERequest>Excel,regPath,R%k1%C1,result,0
If>result<>CRLF,scan
//So k is first empty cell, put clipboard contents in it
DDERequest>Excel,file_names_%k%,R2C3,firm,0
DDERequest>Excel,file_names_%k%,R3C3,date,0
DDERequest>Excel,file_names_%k%,R5C3,contragent,0
let>k2=k1-1
let>lastNum="=R[-1]C3+1"
//DDERequest>Excel,regPath,R%k2%C3,lastNum,0
DDEPoke>Excel,regPath,R%k1%C1,firm
DDEPoke>Excel,regPath,R%k1%C2,date
DDEPoke>Excel,regPath,R%k1%C3,lastNum
DDEPoke>Excel,regPath,R%k1%C4,contragent
DDERequest>Excel,regPath,R%k1%C3,num,0
DDEPoke>Excel,file_names_%k%,R4C3,num
XLSave>xlBook,regPath
XLQuit>xlBook
VBRun>OpenExcelFile,Z:\Обмен\Поставка\Цены+Учет\УЧЕТ\Учет движения поставок ПЗПК роботизированный.xlsx
Let>WF_TYPE=2
SetFocus>%oldfilename% - Excel
Let>k3=7
Label>scan2
Let>k3=k3+1
DDERequest>Excel,file_names_%k%,R%k3%C4,result,0
If>result<>CRLF,scan2
SetFocus>Учет движения поставок ПЗПК роботизированный - Excel
Let>k4=k3-1
let>range="R8C4:R%k4%C15"
//HELP HERE!!!
//I need to copy the specified range from one Excel book to the first empty table row of another book
Until>k,file_names_count
else
//Отправить письмо что нет заявок
EndIf