Click checkbox in excel file

Hi @Asanka

Once Try using Check Activity
image

Mark as solution and like it if it helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

will this work in an excel application scope?

Hi @Asanka

Try it using Excel Application Scope as @bcorrea said.

If not then without Excel Application Scope you can try.

Just try and check. Sometimes at 1st time itself it works without trying previously. :sweat_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

I dont have that activity. What package is it under?

Hi @Asanka

image
image

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Hey,

I was actually able to get it to check using VBA. I just recorded the macro and it works. However, I don’t want to use “Execute Macro” because I don’t want these macros housed in the actual excel file. I tried to use invoke VBA code but when it runs it, it does not work. I just pasted the excel vba into a txt file but it doesn’t work. Any ideas whats wrong with the below code? I think I am missing something:

Sub Macro3()

’ Macro3 Macro


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

Yeah I dont have that package or some reason

I guess I’m asking how do you convert a macro into VBA

Hi @Asanka

This is one of the dummy example for the same
InvokeVBA Example.zip (15.7 KB)

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Hey yeah so I get how to use the invoke vba. I’m just wondering why the actual vba is not working. If I run the macro in excel it works fine. however, if I take that code and store it in a text file and then invoke the vba it does not work. I don’t even get an error. It just doesn’t work

Interesting.

I did a reboot and now I get this error when trying to invoke the code:

Source: Invoke VBA

Message: Cannot run the macro ‘CheckBox’. The macro may not be available in this workbook or all macros may be disabled.

Macros are enabled

HI @Asanka

Check below threads for the same :-

Enable or disable macros in Microsoft 365 files - Microsoft Support

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:


and
image

Thanks! I just needed to reboot and its all good now!

Haha okay next quetion:

I have the below code that im invoking:

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

How do I change the 1 in “Check Box 1” with a variable that I want to pass in from Uipath? Is this possible?

You need arguments (parameters in your sub) and the invoke vba has parameters too:

2 Likes

Hey thanks for this. I’ve read it and other posts but I can’t figure it out. This is what I have in my vba code:

Sub CheckBox(n as string)

ActiveSheet.Shapes.Range(Array("Check Box n")).Select
With Selection
    .Value = xlOn
    .LinkedCell = ""
    .Display3DShading = False
End With
Range("D1").Select

End sub

And I created a variable of string type named “n” in my workflow. I set the default value to 3. I used {n} as my entry method.

I think i’m missing a link here though, possibly in my vba code?

Never mind. I got it. Thanks for all your help!

1 Like

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