๐Ÿš€ UiPath invoke VBA Script 2way(Excel Macro, Invoke VBA)

UiPath Excel ๋ฐ์ดํ„ฐ ๋ณ€๊ฒฝ

Posted by labft3231 on March 20, 2020

UiPath invoke VBA 2way(Excel Macro, Invoke VBA) ๐Ÿ”ฌ

  • UiPath์—์„œ VBA๋ฅผ ํ™œ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ํฌ๊ฒŒ 2๊ฐ€์ง€๋กœ ๋‚˜๋ˆ„์–ด์ ธ ์žˆ์Šต๋‹ˆ๋‹ค.
  • 2๊ฐ€์ง€ ๋ฐฉ๋ฒ•์ค‘ ์–ด๋–ค ๊ฒƒ์„ ํ™œ์šฉํ• ์ง€ ํ”„๋กœ์ ํŠธ์˜ ํŠน์„ฑ๊ณผ ์กฐ๊ฑด์œผ๋กœ ํŒ๋‹จํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

https://github.com/labft3231/VBABasic ๐Ÿ‘ˆ invoke VBA Script 2way ๋งํฌ



ํŠน์„ฑ

Excel Macro Activity ํ™œ์šฉ

  • ์ด๊ฑด VBA๊ฐ€ ์ด๋ฏธ ์ž…๋ ฅ์ด ๋˜์–ด ์žˆ๋Š” Excel์—์„œ ํ™œ์šฉ์ด ๊ฐ€๋Šฅํ•˜๋‹ค.
  • ๊ธฐ์กด ์—‘์…€์— ์ž…๋ ฅ๋œ VBA๋ฅผ ํ™œ์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์—‘์…€ ๋‚ด๋ถ€์˜ Alt + F11 ๋ฅผ ํ†ตํ•ด์„œ ํ™œ์šฉํ•  VBA ์†Œ์Šค์˜ ํ•จ์ˆ˜๋ฅผ ๊ธฐ์–ตํ•˜๊ณ  UiPath Studio ๋‚ด์— ์‚ฌ์šฉํ•  ๋ฉ”ํฌ๋กœ ํ•จ์ˆ˜๋ช…์„ ์ž…๋ ฅํ•˜๋ฉด ์‹คํ–‰๋œ๋‹ค.
  • Excel Macro Activity๋Š” ํ•ญ์ƒ Excel Application Scope์— ํฌํ•จ๋˜์–ด์•ผ ํ•œ๋‹ค.
  • ์—‘์…€์— ์ด๋ฏธ Macroํ˜•ํƒœ๊ฐ€ ์ €์žฅ๋˜์–ด ์žˆ๋Š” ํ˜•ํƒœ์ด๊ธฐ ๋•Œ๋ฌธ์— ์—‘์…€์˜ ํ™•์žฅ์ž๋ช…์ด .xlsm์ด์–ด์•ผ ํ•œ๋‹ค.


invoke VBA Activity ํ™œ์šฉ

  • ๋น„๊ต์  ์“ฐ์ž„์ด ์ž์œ ๋กญ๋‹ค.
  • txt ํŒŒ์ผ์— VBA Script๋ฅผ ์ž…๋ ฅํ•˜๊ณ  Studio ๋‚ด์—์„œ ์ ์šฉํ•  Excel ํŒŒ์ผ๊ณผ VBA ํŒŒ์ผ๋‚ด์— ์žˆ๋Š” ํ•จ์ˆ˜๋ช…์„ ์ž…๋ ฅํ•œ๋‹ค.
  • invoke VBA Activity ๋˜ํ•œ Excel Application Scope ๋‚ด์— ํฌํ•จ๋˜์–ด์•ผํ•œ๋‹ค.
  • ์—‘์…€์—์„œ ์™ธ๋ถ€ ๋ฉ”ํฌ๋กœ ์‚ฌ์šฉ์„ ํ—ˆ์šฉํ•ด์ค˜์•ผ ์‹คํ–‰๋œ๋‹ค.
    (์„ค์ • -> ์˜ต์…˜ -> ๋ณด์•ˆ์„ผํ„ฐ -> ๋ณด์•ˆ์„ผํ„ฐ ์„ค์ • -> ๋งคํฌ๋กœ ์„ค์ • -> VBA ํ”„๋กœ์ ํŠธ ๊ฐ์ฒด ๋ชจ๋ธ์— ์—‘์„ธ์Šค ์ฒดํฌ)
  • ์ฃผ์˜์ ์€ ์ด๋ฏธ ์ž…๋ ฅ๋œ ๋ฉ”ํฌ๋กœ์™€ txt์—์„œ ๋ถˆ๋Ÿฌ์˜ฌ ๋ฉ”ํฌ๋กœ ์ค‘๋ณต์ด ๋˜๋ฉด ์ถฉ๋Œ์ด ๋‚œ๋‹ค.



RPA๋ฅผ ํ™œ์šฉํ•˜์—ฌ ๋‹ค์ˆ˜์˜ Excel ํŒŒ์ผ์— ๋ฉ”ํฌ๋กœ๋ฅผ ์ ์šฉํ•ด๋ณด์ž ๐Ÿ“‘

์‹คํ–‰์ด ๋˜์ง€ ์•Š๋Š”๋‹ค๋ฉด ์—‘์…€ ํŒŒ์ผ์„ ์—ด์–ด๋ณด๊ณ  ๋ฌธ์„œ๊ฐ„์˜ ์ถฉ๋Œ๋„ ํ™•์ธํ•ด์•ผํ•˜๋ฉฐ, ๋ณด์ด์ง€ ์•Š๋Š” ์—‘์…€ ํ”„๋กœ์„ธ์Šค๋ฅผ ํ™•์‹คํžˆ ์ข…๋ฃŒํ•˜๊ณ  ๋‹ค์‹œ ์‹œ๋„ํ•ด๋ด์•ผํ•ฉ๋‹ˆ๋‹ค.