Change excel column width using VB invoke code

Hi,
Please let me know how I can change the width of the excel columns using VB scripting below is sample of same:
Dim excel As Microsoft.Office.Interop.Excel.Application
Dim wb As Microsoft.Office.Interop.Excel.Workbook
Dim ws As Microsoft.Office.Interop.Excel.Worksheet
Dim wks As Microsoft.Office.Interop.Excel.Worksheets
Dim rng As Microsoft.Office.Interop.Excel.Range
Dim i As Long
Dim theRange As String
excel = New Microsoft.Office.Interop.Excel.ApplicationClass
wb = excel.Workbooks.Open(Path)
excel.Visible=True
‘ws=CType(wb.Sheets(“Output”),Microsoft.Office.Interop.Excel.Worksheet)’
wks(“Sheet3”).Columns(“A”).ColumnWidth = 8

this forum is for UiPath not VB…!!!

See these they might help you -

@skini76 This is the friendliest forum you will ever see, we should try to help each other even if the topic is out of scope and here this particular topic is completely in the scope because UiPath uses VB code. C’mon it is for us ultimately we have to make this forum better everyday

1 Like

@skini76 LOL… UiPath uses VBS for invoke VBA activity so… let him ask the doubt…

1 Like

@Pablo_Sanchez - that would be Let her ask the doubt :smiley::smile: I know it is very hard to find this by name only if there is no DP :smiley:

There are forums for VBA and answer is readily available and response to the queries could be faster. I am injecting a java script in UiPath, the java script has errors, so should I post JavaScript related queries ? This way forum will get diluted and will loose significance. My sincere appeal is to restrict queries to UiPath, but no one can stop you from posting queries which are not related to UiPath.

Hi,
To set the column width . you can use the “Autofit Columns” activity which is existing in the below link.


Regards
Balamurugan.S

1 Like