Jump to content

how to copy one cell at a time from excel sheet and parse the data into outlook mail?


Go to solution Solved by water,

Recommended Posts

Thanks for the clarification!
So I suggest to use the Printer Management UDF and archive your mail using the following steps:

  • Query the current default printer
  • Change the default printer to "pdf2edoc"
  • Print the mail using _OL_Itemprint
  • Reset the default printer to the one retrieved in step 1

Note: I have never used the Printer Management UDF so I'm not sure it works as I proposed.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Seems to be correct. Is the window youi want to send this keys to active?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Hello Water,

Rest of the Keys working and active in this window.

 

Local $TiTle
If WinExists('edoc') = True Then
    WinActivate('edoc')
    $TiTle = WinGetTitle('edoc')
 EndIf
Local $hWnd = WinGetHandle($TiTle,'')

Send("^l")

Local $var = InputBox("Input Box", "Please Enter your SO #") ; getting SO # 

ControlSetText("[CLASS:TfmCollate]", "", "TScaleEdit1",$var) ;open SO file in log screen
Send("{ENTER}")
ControlSetText("[CLASS:TfmCollate]", "", "TComboBox1",$var) ;open SO file in log screen
Send("!m")
Send('b')
Send('l')
Send("{Enter}")
Send('^+e')

 

 

Link to comment
Share on other sites

Hello Water,

I have used active code again to active this window, now its working.

Thanks for the help.

 

Local $TiTle
If WinExists('edoc') = True Then
    WinActivate('edoc')
    $TiTle = WinGetTitle('edoc')
 EndIf
Local $hWnd = WinGetHandle($TiTle,'')

Send("^l")

Local $var = InputBox("Input Box", "Please Enter your SO #") ; getting SO # 

ControlSetText("[CLASS:TfmCollate]", "", "TScaleEdit1",$var) ;open SO file in log screen
Send("{ENTER}")
ControlSetText("[CLASS:TfmCollate]", "", "TComboBox1",$var) ;open SO file in log screen
Send("!m")
Send('b')
Send('l')
Send("{Enter}")
Local $TiTle
If WinExists('edoc') = True Then
    WinActivate('edoc')
    $TiTle = WinGetTitle('edoc')
 EndIf
Local $hWnd = WinGetHandle($TiTle,'')
Send('^+e')

 

Link to comment
Share on other sites

If shift is needed to send an upper case character you could use

Send('^E')

as well

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Hello Water,

I have wrote the script which go into our system, create email with documents attachment, now i want to add TO email,CC email, subject and body 

Can you guide?

 

Local $TiTle
If WinExists('edoc') = True Then
    WinActivate('edoc')
    $TiTle = WinGetTitle('edoc')
 EndIf
Local $hWnd = WinGetHandle($TiTle,'')

Send("^l")

Local $var = InputBox("Input Box", "Please Enter your SO #") ; getting SO # 

ControlSetText("[CLASS:TfmCollate]", "", "TScaleEdit1",$var) ;open SO file in log screen
Send("{ENTER}")
ControlSetText("[CLASS:TfmCollate]", "", "TComboBox1",$var) ;open SO file in log screen
Send("!m")
Send('b')
Send('l')
Send("{Enter}")
Sleep(1000)
Local $TiTle
If WinExists('Collation') = True Then
    WinActivate('Collation')
    $TiTle = WinGetTitle('Collation')
 EndIf
Local $hWnd = WinGetHandle($TiTle,'')
Sleep(2000)
Send('^+e')
Send("{Enter}")
If WinExists('Untitled - Message (HTML)') = True Then
    WinActivate('Untitled - Message (HTML)')
    $TiTle = WinGetTitle('Untitled - Message (HTML)')
 EndIf
Local $hWnd = WinGetHandle($TiTle,'')

 

email.PNG

Link to comment
Share on other sites

_OL_ItemRecipientAdd to add To and CC. _OL_ItemModify to set the mail body.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

No item create is needed. Just pass the object of the already created item to this functions as parameter.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Hello Water,

I need your help on excel, i have request from user to automate their weekly task,

Every week on Monday user pulls data from system and dump in below path, file name will be change on weekly (ie. next week file name will be "AR 27.03.2017-BOM") and folder name will be change monthly (ie." 04 April") rest path will remain same.

F:\COMMON\Branch\BOM-Staff\Monthly AR\03 March\AR 20.03.2017-BOM.xlsx

below is the steps user want us to automate.

1) Save as above files in below path, again,path folder name will be change monthly and weekly (ie . next week folder name will change from "Week 12 change" to  "Week 13" and next month folder name change from "03 Mar" to "04 Apr"

 F:\COMMON\Branch\BOM-Staff\Deptwise AR\2017\03 Mar\Week 12

2) However file need to save as in 8 different name under Week 12 folder (eg. 1) "AE-20.03.2017", 2) "AI-20.03.2017" etc.)

3) there are few more task will discuss later once we able to automate above task.

Link to comment
Share on other sites

Do you run the latest version of the UDF? I fixed two bugs related to recipient resolution.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Strange. This list of recipients is created by your script?
Seems that Outlook thinks it is a single address.
Can you strip down your script so that only _OL_ItemCreate and _OL_ItemRecipientAdd remain? Makes it easier to debug.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Remove all unneeded parts (GUI stuff etc.). So your script will similar only look like:

#include <OutlookEX.au3>
Global $oOL = _OL_Open()
Global $oItem = _OL_ItemCreate(...)
_OL_ItemRecipientAdd($oItem,...) ; Add the recipients the same way your current script does
$oItem.Display()

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Hello Water,

This is how am adding recipients in my email

 

Global $oOutlook =  _OL_Open()
Global $oItem = _OL_ItemCreate($oOutlook, $olMailItem)
If @error <> 0 Then Exit MsgBox(16, "Outlook", "Error creating the mail item. @error = " & @error & ", @extended = " & @extended)
; Set mail format to HTML
_OL_ItemModify($oOutlook, $oitem, Default, "BodyFormat=" & $olFormatHTML)
; Retrieve signature
$oItem.GetInspector
$sSignature = $oItem.HTMLBody
; Set Body to text plus signature
$oItem.HTMLBody = $sBody & $sSignature
$oItem.Display
_OL_ItemModify($oOutlook, $oitem, Default, "BodyFormat=" & $olFormatHTML, "Subject=" & $subject)
_OL_ItemRecipientAdd($oOutlook,$oItem, Default, $olTo, $sCellValue)
_OL_ItemRecipientAdd($oOutlook, $oItem, Default, $olCc, $sCellValue3)
_OL_ItemSend($oOutlook,$oItem)

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...