dpcompower Posted June 12, 2017 Posted June 12, 2017 When I used the function, cell that has value as time (HH:mm, ex: 10:38:00 AM) showed in array as decimal (ex: 0.443055555555556.) There's no parameter in the function to ask it to treat as text at least. This line of code is to load the cell value into the returned array: $avRET[$r][$c] = $oExcel.Activesheet.Cells($iStartRow + $r - 1, $iStartColumn + $c - 1).Value So how can I change it so that it would return the value as Time which is what it was formatted on Excel sheet; or at least text? I did change it to: $avRET[$r][$c] = String($oExcel.Activesheet.Cells($iStartRow + $r - 1, $iStartColumn + $c - 1).Value) But didn't work, I guess it was because of how Excel object deal with cell value. Please help! Thanks.
dpcompower Posted June 12, 2017 Author Posted June 12, 2017 Thanks a lot! Never thought of that simple. I modified the UDF on my PC to have another function to read all cells as text as you told, that way I can use the original one when I do need value. I thought about modify the original function to have another parameter, but I think keep it as is is better way to do.
water Posted June 12, 2017 Posted June 12, 2017 Seems you are using a quite old version of the Excel UDF. The Excel UDF has been rewritten and is now faster and easier to use. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now