Yes I am now able to have the page come up in landscape with a stringbuilder.
I added a private function called AddExcelStyling and called it in the BtnExportExcel_Click.
This makes the page come in as landscape:
The bold section makes the page comes in as landscape. What I have bold underneath I am trying to get the text to wrap but it's not doing it.
Private Function AddExcelStyling() As String
Dim sb As New StringBuilder()
sb.Append("<html xmlns:o='urn:schemas-microsoft-com:office:office'" & vbLf & "xmlns:x='urn:schemas-microsoft-com:office:excel'" & vbLf & "xmlns='http://www.w3.org/TR/REC-html40'>" & vbLf & "<head>" & vbLf)
sb.Append("<style>" & vbLf) sb.Append("@page")
sb.Append("{margin:.0in .0in .0in .0in;" & vbLf)
sb.Append("mso-header-margin:.5in;" & vbLf)
sb.Append("mso-footer-margin:.5in;" & vbLf)
sb.Append("mso-page-orientation:landscape;}" & vbLf)
sb.Append("mso-header-text:wrap;}" & vbLf)
sb.Append("</style>" & vbLf)
sb.Append("<!--[if gte mso 9]><xml>" & vbLf)
sb.Append("<x:ExcelWorkbook>" & vbLf)
sb.Append("<x:ExcelWorksheets>" & vbLf)
sb.Append("<x:ExcelWorksheet>" & vbLf)
sb.Append("<x:Name>Projects 3 </x:Name>" & vbLf)
sb.Append("<x:WorksheetOptions>" & vbLf)
sb.Append("<x:Print>" & vbLf)
sb.Append("<x:ValidPrinterInfo/>" & vbLf)
sb.Append("<x:PaperSizeIndex>9</x:PaperSizeIndex>" & vbLf)
sb.Append("<x:HorizontalResolution>600</x:HorizontalResolution" & vbLf)
sb.Append("<x:VerticalResolution>600</x:VerticalResolution" & vbLf)
sb.Append("</x:Print>" & vbLf)
sb.Append("<x:Selected/>" & vbLf)
sb.Append("<x:DoNotDisplayGridlines/>" & vbLf)
sb.Append("<x:ProtectContents>False</x:ProtectContents>" & vbLf)
sb.Append("<x:ProtectObjects>False</x:ProtectObjects>" & vbLf)
sb.Append("<x:ProtectScenarios>False</x:ProtectScenarios>" & vbLf)
sb.Append("</x:WorksheetOptions>" & vbLf)
sb.Append("</x:ExcelWorksheet>" & vbLf)
sb.Append("</x:ExcelWorksheets>" & vbLf)
sb.Append("<x:WindowHeight>12780</x:WindowHeight>" & vbLf)
sb.Append("<x:WindowWidth>19035</x:WindowWidth>" & vbLf)
sb.Append("<x:WindowTopX>0</x:WindowTopX>" & vbLf)
sb.Append("<x:WindowTopY>15</x:WindowTopY>" & vbLf)
sb.Append("<x:ProtectStructure>False</x:ProtectStructure>" & vbLf)
sb.Append("<x:ProtectWindows>False</x:ProtectWindows>" & vbLf)
sb.Append("</x:ExcelWorkbook>" & vbLf)
sb.Append("</xml><![endif]-->" & vbLf)
sb.Append("</head>" & vbLf)
sb.Append("<body>" & vbLf) Return sb.ToString()
End Function