Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-27-2024, 11:18 PM
ArviLaanemets ArviLaanemets is online now Reading date from string Windows 8 Reading date from string Office 2016
Expert
Reading date from string
 
Join Date: May 2017
Posts: 932
ArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant future
Default Reading date from string

Hi

I designed an Excel app, which did read client forecasts from Excel file. Until now client's column headers for forecast quantities were in format 'Forecast mm', i.e. like 'Forecast 07'. The starting year was read from file name, and whenever next month number was less than previous, 1 was added to forecast year. The day of forecast date was determined by app's Setup.

Now the client did change the format of those headers. The new format for header is 'Forecast mmmm yyyy', i.e. like 'Forecast July 2024' (month names are in english).



My problem is, that employee working with app may have non-english/non-US local settings for Windows, and I cold't find any info, how will VBA work then. Will e.g. Datevalue('July 28, 2024') recognized as date, when user's local setting is not english or US (as example the same date in my local format may be '28. juuli 2024.a.' instead, and I haven't any clue what it may be in local format for possible users - the app is used in another country, and different users may have different local settings set up also)?

Or are Date formats used in Datevalue() limited to english language only, and are not affected by local settings?
Reply With Quote
  #2  
Old 08-28-2024, 01:39 AM
ArviLaanemets ArviLaanemets is online now Reading date from string Windows 8 Reading date from string Office 2016
Expert
Reading date from string
 
Join Date: May 2017
Posts: 932
ArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant future
Default

Btw, I tested in watches window, and DateValue("July 1, 2024") returned an error! DateValue("1. juuli 2024") did work!

Is there a way to force Datevalue() to accept any US format with full month name in it, regardless of local date settings?
Reply With Quote
  #3  
Old 08-28-2024, 07:06 AM
macropod's Avatar
macropod macropod is offline Reading date from string Windows 10 Reading date from string Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,360
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

A bit hard without seeing a sample workbook and code.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 08-28-2024, 07:19 AM
ArviLaanemets ArviLaanemets is online now Reading date from string Windows 8 Reading date from string Office 2016
Expert
Reading date from string
 
Join Date: May 2017
Posts: 932
ArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant future
Default

I simply added a Select Case statement to get month numbers instead month names.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel reading date incorrectly sam123456 Excel 1 02-12-2022 12:39 AM
Date formatting on String field neubs007 Mail Merge 1 12-13-2021 10:12 PM
Extracting date, month & year from a text string without using date format Help Haha88 Excel 5 08-06-2021 01:19 PM
Microsoft Excel to extract date from another string Rajeshwar Excel 1 10-26-2016 09:57 AM
Reading date from string How to save a PPT file in 'Reading View' to be opened always in 'Reading View' ItzVickey PowerPoint 2 08-08-2012 09:23 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:24 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft