RichardOneil
MIS
Hi All-
I have a Word Document that uses VBA to get user input and then create a merge document based on this information. The user has the option to create an Excel file that contains all the data in the merge source document. Two fields that are being somewhat problematic are the Emp Number and Dept fields because they often contain leading and/or trailing zeroes that Excel drops. I am trying to use VBA to format the column that these fields will be in as text, but I am not having any luck. This is my code:
Set xlApp = CreateObject("Excel.Application")
xlApp.Application.Visible = True
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
xlSheet.Columns("C").Select
xlSheet.Selection.FormatNumber = Text
Everything works except the last line where I get the "Object doesn't support this method or property" error. I have been looking through the Help file, but I can't figure out which object/method to use. Any help would be great. TIA.
Richard
I have a Word Document that uses VBA to get user input and then create a merge document based on this information. The user has the option to create an Excel file that contains all the data in the merge source document. Two fields that are being somewhat problematic are the Emp Number and Dept fields because they often contain leading and/or trailing zeroes that Excel drops. I am trying to use VBA to format the column that these fields will be in as text, but I am not having any luck. This is my code:
Set xlApp = CreateObject("Excel.Application")
xlApp.Application.Visible = True
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
xlSheet.Columns("C").Select
xlSheet.Selection.FormatNumber = Text
Everything works except the last line where I get the "Object doesn't support this method or property" error. I have been looking through the Help file, but I can't figure out which object/method to use. Any help would be great. TIA.
Richard