Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Date format in vb 6.0

Date format in vb 6.0

Scheduled Pinned Locked Moved Visual Basic
questionlearning
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Britnt7
    wrote on last edited by
    #1

    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

    R 1 Reply Last reply
    0
    • B Britnt7

      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

      R Offline
      R Offline
      rwestgraham
      wrote on last edited by
      #2

      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

      B 1 Reply Last reply
      0
      • R rwestgraham

        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

        B Offline
        B Offline
        Britnt7
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups