Create borders for a specific range in Excel using run vbscript in Power Automate Desktop

46 Views Asked by At

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
0

There are 0 best solutions below