Goal: I want to copy a specific range from excel to the clipboard.
Problem: I get an error message saying "The Following variable name contains illegal character"
Question: How can I change this code to avoid the error messages?
Code: Select all
XL := ComObjActive("Excel.Application") ; Creates a handle to excel vSheetName := %SheetName% ; User select the SheetName from a gui dropdown clipboard := XL.Sheets(vSheetName).Range("BY14:BZ22") ; Clipboard copies the specific range within the SheetName