Hi Malligai,
It will require taking a deeper look at your code and also it does not have the actual error you are seeing in the Initialize page. But if you would like to explore an easier option then it is as below.
- Make a duplicate copy of the 'Select' action tab of the Ms Excel VBO. Right click on the tab name and you will find a duplicate option.
- The only change needed to be made in the Code stage as compared to the Select, is adding the below line.
excel.Selection.EntireColumn.Hidden = True
Rest all remains the same since you anyways need to Select the columns first before hiding them.
Code:
Dim wb, ws As Object
Dim excel, sheet, range As Object
Try
wb = GetWorkbook(Handle, Workbook)
ws = GetWorksheet(Handle, Workbook, Worksheet)
wb.Activate()
ws.Activate()
excel = ws.Application
sheet = excel.ActiveSheet
range = sheet.Range(Reference)
range.Select()
excel.Selection.EntireColumn.Hidden = True
Success = True
Catch e As Exception
Success = False
Message = e.Message
Finally
wb = Nothing
ws = Nothing
excel = Nothing
sheet = Nothing
range = Nothing
End Try
- For hiding the Column E in your case pass the cell reference parameter from the Process as "E:E".
For non-consecutive multiple columns pass, "A:C, F:F"
and for consecutive multiple columns pass as "A:E".