Using VBA to click in check boxes

Hello guys, good afternoon!!

I’m trying to develop a small script to check all checkboxes.
here is my example:

code:

Sub Clickall()
With Selection
ActiveSheet.Shapes.Range(Array(“Check Box 2”)).Select
.Value = xlOn
.LinkedCell = “”
.Display3DShading = False
End With
End Sub

image

I’m trying to launch this thing from UiPath but I’m doing several things wrong I’m afraid.

Here’s my program:
Dir.xaml (6.8 KB)

Can someone help me to better understand this thing?
Thank guys!

Hi @Andre_Vieira ,

You can use it as

Put this in Excel App scope
As you don’t have arguments in your function so no need to pass anything in method parameters.
image

Hello dear ermanoj!

With you, as usual… this thing is gatting better :joy: :joy:

But now i’m receiving this error:

image

accordingly with the debbuger:
image

Let me edit this thing…

This is your function error, i told you to invoke it properly :grinning:

I deleted the .LinkedCell = “”

My code now:
Sub Clickall()
With Selection
ActiveSheet.Shapes.Range(Array(“Check Box 2”)).Select
.Value = xlOn
End With
End Sub

image

I’m not receiving any error now, but nothing happens too.

Maybe i have to save this action?

Try that.

Look, instead checking the box, the script is adding a number 1 randomlly into the exel sheet.

If possible, Can you share this excel?

I want to try it from Macro code.

Yes bro,
See if you can open the link please

[quote=“Andre_Vieira, post:1, topic:333012”]

Try this code, it’s working for me

https://www.extendoffice.com/documents/excel/4302-excel-uncheck-all-checkboxes.html

You want Macro let me know

Let me see!

Use below code
test.xaml (5.8 KB)

Create one macro file and put this code inside as forum not allowing me to upload xlsm file here.

Public Function Check(filePath As String, sheetName As String)
Dim xlWorkbook As Workbook
Dim xlWorksheet As Worksheet
Dim xlRange As Range
Set xlWorkbook = Workbooks.Open(filePath, UpdateLinks:=False)
Set xlWorksheet = xlWorkbook.Worksheets(sheetName)
For Each chkBox In xlWorksheet.CheckBoxes
chkBox.Value = xlOn
Next chkBox
xlWorkbook.Save
xlWorkbook.Close
End Function

1 Like

It is working for me too,

image

but:

image

I have no idea what this is, let me iterate over it.

Thank you bro

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.