I am trying to run a VBscript through Power Automate Desktop to add borders to a certain range in an Excel Worksheet. I am not sure what I am doing wrong but I am getting an error saying Type Mismatch: Range.
I have attached the code here for reference. I am initializing the variable - Excel File with the file path
Dim Excel
Dim ExcelDoc
'Opens the Excel file
Set Excel = CreateObject("Excel.Application")
Set ExcelDoc = Excel.Workbooks.open("%ExcelFile%"
Dim myRange As Range
Set myRange = Range(“A1:C3")
With myRange.Borders
.LineStyle = xlContinuous
.Colorindex = 0
.TintAndShade = 0
.Weight = xlThin
End With
'Closes the Excel file
Excel.ActiveWorkbook.Close
Excel.Application.Quit
Set myRange = Range(“A1:C3")
... the one next the left ofA1
looks dodgearama. That's the first thing, also, where's the closing bracket next to%ExcelFile%
? I'd suggest you need to maybe be explicit regarding the worksheet you want to get the range for as well. That's my suggestion.Run Excel Macro
(VBA code) with PA desktop. Microsoft documentation: > Excel actions