hi
I’m getting this issue while I’m formatting Excel columns(format range to type “Text”).
These are my activity packages:
UiPath.Excel.Activities = 2.24.3
UiPath.MicrosoftOffice365.Activities = 2.7.24
Activity name : FormatRangeX
Soruce Range : excel.Sheet(mysheetnamevariable).Range(“F2:F”+LastRow.ToString)
Format data as : “text”
These checks are Done:
No other excel file is open.
No delay due to added add-ins.
Excel is opening in background.
Robot is running in unattended mode but i have tried in attended mode as well, i do see the issue here as well.
used excel process kill activity before invoking this sub flow for formatting excel columns.
LastRow variable has data and is not null.
I have never used StudioX activities extensively so not sure whether the activities are stable. If anyone has experience using studiox activities and have come across some issue like this, please let me know.
p.s.: I can use VBA for formatting instead of StudioX Excel activities.(but that would be last resort for now).
Appreciate any help.
Thanks.
SG.
1 Like
1. Switch to Classic Excel Activities (with Use Excel File + Set Range Format)
You don’t need to use StudioX for this — the Classic Excel activities are more stable and suitable for unattended automation.
Steps:
- Use “Use Excel File” (with Excel Process Scope enabled)
- Use “Set Range Format” activity
- Range: “F2:F” + LastRow.ToString
- Format: “Text”
2. Try Limiting the Range Explicitly
StudioX activities might behave unpredictably when working with full-column references. Instead of F2:F + LastRow:
- Try F2:F1000 or a hardcoded range to test.
- Validate whether it behaves better.
3. Add Delay Before FormatRangeX
Even though Excel seems to be initialized, try adding a small delay (1-2 sec) after opening Excel and before formatting the range. This has helped in cases where StudioX activities were racing ahead.
4. Ensure Excel is Not in “Protected View” Mode
If the Excel file is downloaded or copied from a network/Outlook, it might open in Protected View silently in the background — and StudioX activities won’t throw an error but will silently fail.
Ensure:
- File is fully trusted
- You unblock it (right-click > Properties > Unblock)
5. Try with Excel Application Scope + Invoke VBA
If everything fails, here’s a non-ugly VBA workaround you can run inside Excel Scope:
Sub FormatColumnAsText()
With Columns(“F”)
.NumberFormat = “@”
End With
End Sub
Use “Invoke VBA” with this macro text and target workbook.
If this finds you solution then mark it as SOLUTION
Happy Automation
1 Like
sure, will try to replace StudioX activities in the first place and see..
Thanks for the inputs.