Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excell Problem

Status
Not open for further replies.

Stewart531

Programmer
Feb 18, 2003
36
US
I'm trying to send a string into a cell. The string contains a date of the form xx/xx/xx xx:xx AM/PM. The problem is that vb treats the xx/xx/xx as an operation, and sends a decimal to the cell in the spreadsheet. Here is an example of the code:

msobj.Cells(1, 1).Value = strDate

I'm pretty sure this is happening on the vb side because I set the column's properties to "text only". Any ideas? Thanks.
 
Nevermind, I figured out my problem. My code was actually:

msobj.Cells(1, 1).Value = rs!Date

It seems like I couldn't assign a value from a record in a table directly into the cell. I just added these lines of code and it now works:

dim tempstring as string
tempstring = rs!Date
msobj.Cells(1, 1).Value = tempstring
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top