Format method in VB

Author Message
POD64

  • Total Posts : 23
  • Scores: 0
  • Reward points : 0
  • Joined: 10/25/2005
  • Status: offline
Format method in VB Sunday, February 18, 2007 6:06 AM (permalink)
0
Hi all,
I'm trying to format a date in "dd/m/yy", which works really fine in a string variable, but i want it to remain in a Date type (not string).
The purpose is to use Find method to find a cell formatted as date.
 Dim objExcelApp As Excel.Application
  Dim objFound As Range
  Dim objWorksheet As Worksheet
  Dim objRange As Range
  Dim y As Date
 
  Set objExcelApp = New Excel.Application
  Set objWorkbook = objExcelApp.Workbooks.Open(XLS file)
  Set objWorksheet = objWorkbook.Worksheets(1)
  Set objRange = objWorksheet.Range("a3").EntireRow
  y = Format(Date + 2, "dd/m/yy")
  Set objFound = objRange.Find(y)
 

At this state "y" returns a date formatted as my system is configured, but when i change "y" to be a string i get it as "dd/m/yy" without a problem.
 
Why is that?
 
Thanks in advance.
 
#1

    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 1 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2012 ASPPlayground.NET Forum Version 3.9