Excel output from Access VBA
Posted on 2015-02-20
I have an Access VBA application that writes to an Excel spreadsheet. I have a serial number field that is a text field in access and contains alphanumeric data. There are some that are numeric only and if the number is large, it appears on the spreadsheet as a scientific notation. (eg. 5.30559E+12 instead of 5305588100056). I have tried everything I can think of to force it to always print just as text.
In my code I have:
strSerialNumber = Nz(!SerialNumber, "")
objXLS.Cells(intRow, 4).Value = RTrim$(strSerialNumber)
objXLS.Cells(intRow, 4).NumberFormat = "@"
Any help if forcing the serial number to always display as text would be appreciated.