Hello,
I would need to do some cell formatting in Excel (aligning left+right+center, bolding, underlining) and apparently there is no way to do these with basic Excel VBO actions. Has somebody struggled with same thing and found a way to do these?
I have very little knowledge of VB.NET but I´ve tried to write separate code stages for each of these actions but cannot get those working.
Here´s a code example:
------------------------
Dim wb, excel, range As Object
Try
wb = GetWorkbook(Handle, Nothing).ActiveSheet
excel = wb.Application
range = excel.Selection
range.HorizontalAlignment = xlRight
Finally
End Try
-------------------------------
When I press Check Code I get error "Compiler error - xlRight is not defined". I assume it´s because required assembly and namespace are missing. I added Assembly: Microsoft.Office.Interop.Excel.dll and Namespace: Microsoft.Office.Interop.Excel. After that Check Code does not give error anymore.
However when I try to run the process, it stops to the first step and gives an error:
23.5.2017 9:41:07 ACTION: 'Create instance' Process: 'AR Dunning New' Subsheet: 'Import Excel sheets to collections' ERROR: Internal : Could not run the object because one of the code stages has a compile error, use Check for Errors for a list of problems
Any help would be highly appreciated!
BR, Jari