I am having problems outputing to my excel spreadsheet. I need the entire sheet to all formatted as text. It is messing up my account numbers when formatted as a number.

This is what my code looks like, but it doesn't seem to like it.
VB Code:
  1. Dim MyExcel As New Excel.Application
  2.         Dim oWorkbooks As Excel.Workbooks = MyExcel.Workbooks
  3.         Dim theWorkbook As Excel.Workbook = oWorkbooks.Add
  4.         Dim oSheet As Excel.Worksheet
  5.         Dim rng As Excel.Range
  6.         Dim exFile As String
  7.         Dim i As Integer
  8.         Dim c As Integer

This is where I am trying to format as text:

VB Code:
  1. oSheet.Range("A2:Z999").Select()
  2.             oSheet.Selection.NumberFormat = "@"

Thanks in advance!