Hi, i want to add a for each activity where i want to paste each page copied from a sheet to a word document and close the message boxes. i am using the below vba code in a excel can you help me develop this sequence.
vba code.txt (2.3 KB)
- Read Data from Excel:
- Excel Application Scope: Set the
WorkbookPath
to your Excel file path.- Read Range: Output the data to a DataTable variable (
dataTable
).
- Read Range: Output the data to a DataTable variable (
- For Each Row in DataTable:
- For Each Row: Loop through
dataTable
.- Assign:
copiedData = row("ColumnName").ToString
- Assign:
- Open Word Document:
- Word Application Scope: Set the
DocumentPath
to your Word document path.- Send Hotkey:
ctrl+end
(navigate to the end of the document). - Send Hotkey:
enter
(add a new line). - Set To Clipboard: Set
copiedData
to the clipboard. - Send Hotkey:
ctrl+v
(paste the data).
- Send Hotkey:
- Handle Message Boxes:
- Parallel:
- Branch 1:
- Element Exists: Check if the message box exists (
messageBoxExists
). - If
messageBoxExists
:- Click: Click the “OK” button of the message box.
- Element Exists: Check if the message box exists (
- Branch 2:
- Delay: Add a short delay (
00:00:01
) to allow the message box to appear.
- Delay: Add a short delay (
- Branch 1:
i am using paste to chart activity( reusable component) to paste the image since the image is already copied to the clipboard. Can you help me write the code around this ?
could you explain what exactly you want ?
a vba code performing entire activity or mix of both vba and UiPath ?
i want a mix of both the vba script i sent and UiPath pasting each image using paste/chart activity as i have figure title heading in the word
hey please see the attached
you need to do some changes to vba code to kake dynamic and invoke it in UiPath
change - sub procedure to accept worksheetname
SelectPrintAreaPages() TO SelectPrintAreaPages(sheet_name as string)
and change the code
set ws= activehseet
TO
set ws = worksheets(sheet_name)
to handle pop-up follow the steps which Krishna_raj has suggested .
try and let me know
This worked @armamidwar.
Thank you!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.