Date format in vb 6.0
-
I am using Microsoft Access 97. I am programming the forms using visual basic that comes with Access 97. I am trying to get a certain date in a certain format but can't figure out why it doesn't work. I am updating an excel document. Dim strDate as Date strDate = Format(Now, "mmmm d, yyyy") objSheet.Range("H9").Value = strDate this produces 2/16/2005 I am trying to out put February 16, 2005 What am I doing wrong? Thanks in advance! Beginner in VB
-
I am using Microsoft Access 97. I am programming the forms using visual basic that comes with Access 97. I am trying to get a certain date in a certain format but can't figure out why it doesn't work. I am updating an excel document. Dim strDate as Date strDate = Format(Now, "mmmm d, yyyy") objSheet.Range("H9").Value = strDate this produces 2/16/2005 I am trying to out put February 16, 2005 What am I doing wrong? Thanks in advance! Beginner in VB
There is nothing wrong with your VB format code. My guess is that your excel spreadsheet is reformatting the date value. Check the column formatting properties in Excel - the problem is not the VB part. Robert
-
There is nothing wrong with your VB format code. My guess is that your excel spreadsheet is reformatting the date value. Check the column formatting properties in Excel - the problem is not the VB part. Robert
Your right but do you know how I can set the format to the right property in excel using VB? I will set the value like this: objSheet.Range("H9").Value = Now() Then I should be able to use VB to format that excel object. If I can set the horizontal alignment to right (objSheet.Range("H9").HorizontalAlignment = xlRight) then I should be able to some way set the format property to tell it to show the date as "February 17, 2005". Do you know how? Thanks in advance!! Beginner in VB