Changing Excel Cell Format Dynamically using VB.NET

Dim style As Microsoft.Office.Interop.Excel.Style
Dim exc As New Microsoft.Office.Interop.Excel.Application
Dim workbooks As Microsoft.Office.Interop.Excel.Workbooks = exc.Workbooks
Dim workbook As Microsoft.Office.Interop.Excel._Workbook = workbooks.Add(Microsoft.Office.Interop.Excel.XlWBATemplate.xlWBATWorksheet)
style = workbook.Styles.Add("MyDynamicSyle")
style.NumberFormat = "Text"
style.Font.Name = "Arial"
style.Font.Bold = True
style.Font.Size = 10
style.Interior.Pattern = Microsoft.Office.Interop.Excel.XlPattern.xlPatternSolid
style.HorizontalAlignment = Microsoft.Office.Interop.Excel.XlHAlign.xlHAlighLeft


Author: ABitSmart22 Dec 2009 Member Level: Gold   Points : 0

Please format your resource and soem description.

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: