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)
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.
|
|
|
|