I am programming a Visual Basic application that saves the data as an Excel file. I need to keep my leading 0's but Excel cuts them off. For instance, I insert a string of "00055" into Excel and it ends up being saved as 55. Here is my code.
objXLWs - Excel worksheet
fld - using a variant to move thru the recordset
intRowCount and intColumnCount are to move from A1-A8 and then B,C,D ect
objXLWs.Cells(intRowCount, intColumnCount).Value = CStr(Trim(fld.Value))
As you can see, I tried CStr so ensure that my inserted value is text. I also tried storing the value in a temp string and inserting the temp string from Visual B. It still cut off my 0's. Any idea's?
Bookmarks