@AndersJensen Yes right. I have tried with the below code
Range(“A1”).Font.Color = vbRed
But I’m getting an error :
Error Validation Error No compiled code to run
error BC30512: Option Strict On disallows implicit conversions from ‘String’ to ‘Integer’. At line 1
error BC30451: ‘vbRed’ is not declared. It may be inaccessible due to its protection level. At line 1 Comparing.XAML
@Vrushali_Gave Can you check this Example Workflow : Excel_Automation.zip (16.1 KB)
It is a bit lengthy and the operations can be minimised to be used in Excel Application Scope itself, But I have made use of in memory operations such as Datatable operations more, just to make sure I perform only one Kind of operation in the Excel Application Scope.
(Note : If you have the Column Name already known and is not dynamic you can remove the Number to Letter workflow to get the Column Name in the Excel and replace with the Constant Column Name)
Let me know if this isn’t the kind of output that you were expecting or if it didn’t work at all.
@Vrushali_Gave Are you updating the Column Directly without any condition or is there a validation in place before updating ,Also is the Column to be updated already known or is it dynamic. If it is already known, you can assign the column name directly and remove the Number to Letter workflow.
Also let us know from your perspective as to why you think this is a lengthy process.
@Vrushali_Gave If you are allowed to change the Excel Settings, Can you Perform this Change and then check if the workflow works.
Go to Excel - > Options → Trust Center → Trust Center Settings → Macro Settings → Enable All Macros.
Click on Ok.
Let us know if you are not able to do this or if you still receive the same error even after the change.
@Vrushali_Gave colIndex refers to the Index of the Column and not the column name, According to the Workflow that you have provided you need to use Now.ToString(“dd”) as the column name for identification of the column to be updated in the DT.
But to Change the Color of the Updated value in the Excel you would need to have the column names of the Excel i.e A, B, C, …
I have recognised that you have not used the Number To Letter workflow for retrieving the Column Name of the excel dynamically, but it is very much needed if the Column name is not known.
Note that, The Column Names of the Datatable are different and the Column Name that we need to identify for Changing the Font Color is different.
Can you just execute the below workflow and let me know if it worked. The Test Excel file should have the values under the Column “Update” in red color after the execution.
Then accordingly, you could use your Input file and Column Name, by only changing the values present in the First two Assign Activities and then Execute for your Inputs.