Local $TiTle Local $i, $iTrace, $iMB, $iHB If WinExists('CFIT') = True Then WinActivate('CFIT') $TiTle = WinGetTitle('CFIT') EndIf ;******************************************************************************************************************************************************************************** Local $hWnd = WinGetHandle($TiTle, '') Local $EiRef = StringStripWS(ControlGetText($hWnd, '', 'TEIEdit106'),8) ;getting the file number Local $vsl = StringStripWS(ControlGetText($hWnd, '', 'TEIEdit85'),8) ;getting the vessel details Local $Eihb = StringStripWS(ControlGetText($hWnd, '', 'TEIEdit54'),8) ;getting the vessel details Local $clientno = StringStripWS(ControlGetText($hWnd, '', 'TEIEdit103'),8) ;getting the vessel details ;******************************************************************************************************************************************************************************** ; Write to a Cell using a Loop, after opening a workbook and returning its object identifier. Then Save and Close file. SLEEP(5000) Send("{F6}") Send("{F8}") #include #include $oExcel = _ExcelBookOpen ("C:\client\master.xlsx") Sleep(200) For $i = 1 to 1 $sCellValue1 = _ExcelReadCell($oExcel, $i, 1) If $clientno = $sCellValue1 Then Local $sCellValue = _ExcelReadCell($oExcel,$i,2) Exitloop EndIf Next _ExcelBookClose($oExcel) ;******************************************************************************************************************************************************************************** SLEEP(5000) #include $oExcel = _ExcelBookOpen ("C:\client\body.xlsx") _ExcelWriteCell($oExcel, "Reference", 1, 1) _ExcelWriteCell($oExcel, $EiRef, 1, 2) _ExcelWriteCell($oExcel, "Vessel", 2, 1) _ExcelWriteCell($oExcel, $vsl, 2, 2) _ExcelWriteCell($oExcel, "HAWB", 3, 1) _ExcelWriteCell($oExcel, $Eihb, 3, 2) ;******************************************************************************************************************************************************************************** Sleep(5000) $sReference = "Reference-Value" $sVessel = "Vessel-Value" $sHAWB = "HAWB-Value" ; Create table $sStyle = "" $sBody = $sStyle & "
" & $sReference & "" & $sVessel & "" & $sHAWB & "
" $oOApp = ObjCreate("Outlook.Application") $olMailItem = 0 ; Create the item $oOMail = $oOApp.CreateItem (($oOutlook, $olMailItem, "*", "", "Subject=TestMail", "BodyFormat=" & $olFormatHTML, "HTMLBody=" & $sBody) If @error <> 0 Then Exit MsgBox(16, "Outlook", "Error creating the mail item. @error = " & @error & ", @extended = " & @extended) $oItem.Display ;********************************************************************************************************************************************************************************