[PA] 업무자동화/[XL]Excel & VBA

VBA sendkeys 괄호 없어지는 문제

Weneedu 2023. 10. 27. 13:43

2023.10.27

 

REF

[1] https://stackoverflow.com/questions/44174059/vbs-sendkeys-is-not-sending-charactor

 

동기

셀에 들어 있는 문자를 읽어서 sendkeys로 보낼 때 괄호가 없어진다.

parentheis

 

해결책

sendkeys로 보내기 전에 괄호를 모두 중괄호로 감싼다[1]

sString = "zDYg(8/bY)b6Ox$z"
sStringToSend = Replace( Replace( sString, ")", "{)}"), "(", "{(}")
objShell.SendKeys sStringToSend