Description: REM ***** BASIC ***** Option VBASupport 1 Option Compatible Option explicit Sub Datum() Dim s_tmp As String, d_date As Date s_tmp = InputBox("Plaese insert date :-)", _ "Inputbox") 'check date or string If IsDate(s_tmp) Then 'String into date format d_date = s_tmp 'set Format set Date Range("A1").NumberFormat = "dd/mm/yyyy;@" Range("A1").Value = d_date Else 'no date insert String Range("A1").NumberFormat = "@" Range("A1").Value = s_tmp End If End Sub Steps to Reproduce: 1.run example twice 2. 3. and enter date for a second time Actual Results: runtime error 1 Expected Results: no error Reproducible: Always User Profile Reset: No Additional Info: [Information automatically included from LibreOffice] Locale: de Module: BasicIDE [Information guessed from browser] OS: Linux (All) OS is 64bit: yes
Thank you for reporting the bug. Please attach a sample document, as this makes it easier for us to verify the bug. I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided. (Please note that the attachment will be public, remove any sensitive information before attaching it. See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.)
Created attachment 173464 [details] sub RunThis is inthis file sub RunThis calls two times sub Datum first time witout error second time with error Why ?
Created attachment 173465 [details] sub RunThis is in his file NumberFormat works when entering no date
(In reply to Harald Langheinrich from comment #3) > Created attachment 173465 [details] > sub RunThis is in his file > > NumberFormat works when entering no date If I enter a date in the format dd.mm.yyyy, I get the error immediately and nothing is inserted. If I enter a date in the format dd/mm/yyyy it works fine both times. The macro code looks correct (I could be wrong), so let's set to NEW. NixOS Version: 7.3.0.0.alpha0+ / LibreOffice Community Build ID: b1df9c67349cf4cc5be4128d797aefb87f50e38f CPU threads: 16; OS: Linux 5.13; UI render: default; VCL: x11 Locale: fi-FI (fi_FI.UTF-8); UI: en-US Calc: threaded
Already seen in oldest of 6.3 bibisect repo, but not yet in latest of 5.0
No error in Linux bibisect-44max master, but I get error in bibisect-50max oldest.
The isdate() function recognises a date entered in dd/mm/yyyy format, but not another cell which adds 1 (day) to that date, which is returned as a number. (I creted a calendar in Excel, which uses a combination of formulae and formatting to determine subsequent date values by adding 1 (day) or 7 (week) for sequencial rows and columns. I added code to scan the sheet and compare dates against a list of events (e.g. birthdays) from another sheet, to automatically fill in details in the corresponding position (each 'day' is made up of 3 rows). It works fine in Excel, but fails in Libre Office VBA, because I use isdate() to skip values before the start, and beyond the end, of the month, and it doesn't recognise a numeric date value!