Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

formatting datetime stamp and

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Formatting of Date-Time stamp and messagebox contents

Formatting of Date-Time stamp and messagebox contents

ResolvedVersion 2013

Lone has attended:
Excel VBA Intermediate course

Formatting of Date-Time stamp and messagebox contents

Hi,

I wish to ask 2 questions as below:
Q1. How can I ensure that my date and timestamp on a userform textbox works consistently without confusing UK with US time. I have the code:
txtDateTimeStamp....=Format(txt...Value, "dd mmmm yyyy hh:mm")
This was working well last month but is now showing 12 March 2014 instead of 3 December 2014 or 12 January 2014 instead of 1 December 2014.

Q2. How can I format the contents of a messagebox? (e.g., increase the font size, change font type, turn text to bold, etc).

Thanks in advance for your guidance

RE: Formatting of Date-Time stamp and messagebox contents

Hi Lone

Thanks for you questions.

Q1
I've tried to reproduce your example by changing the regional settings from United Kingdom to US in Control Panel. But the form always sees to display the English format on my pc.

Q2
The font size in a standard Message Box can't be changed.
You can in a User form by changing the Font property.

There are ways but you will have to install Extended MessageBox.NET

http://www.news2news.com/vfp/?solution=5

Probably easier to create your own form and use the Properties to control the font size and type.

Regards
Doug Dunn
Best STL

RE: Formatting of Date-Time stamp and messagebox contents

Hi Doug,

Thank you for your response.
I will explore installation of an extended messagebox in view of Q2.

What is the answer to Q1 regarding formatting of a date and time stamp?

Kindest regards,

L

RE: Formatting of Date-Time stamp and messagebox contents

Hi Lone,

I have tested it and on my pc it show the right date format.

I have attached a workbook with a userform which show the current date on load.

I hope this can help you.

Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

RE: Formatting of Date-Time stamp and messagebox contents

Hi Lone,

I have tested it and on my pc it show the right date format.

I have attached a workbook with a userform which show the current date on load.

I hope this can help you.

Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

Attached files...

date stamp.xlsx

RE: Formatting of Date-Time stamp and messagebox contents

Hi Jens,

Thank you for your response.

There is nothing in both the workbook (comprising sheet 1) and the userform labelled sheet 1(sheet 1). Please send me an updated workbook regarding formatting of date and time stamp.

Kindest regards,

Lone

RE: Formatting of Date-Time stamp and messagebox contents

Hi Lone,

Sorry it is my fault. I saved the workbook as a xlsx file. I have saved it as a macro enable workbook now.

Please find the attached workbook.




Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

Attached files...

date stamp.xlsm

Will be marked as resolved in 5 days

Notice: This is an automated message. Due to inactivity, this forum post will be marked as 'resolved' if there are no further responses in the next 5 days.

RE: Formatting of Date-Time stamp and messagebox contents

Hi Jens,

Thank you for your response and guidance. I have modified the code from the workbook to suit my needs and it is working perfectly.

The code I was using that was confusing US and UK dates is also now working. Since this one has issues of stability or reliability, I will use the one you have suggested and wish to observe it again on 1 January 2015 to confirm and come back to you.

Kindest regards

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Quickly copy a formula across sheets

Suppose you have a formula in cell Sheet1!B2, say =A1*5%, that you wish to copy to cell B2 on Sheet2, Sheet3 and Sheet4. Instead of using copy and paste, try this: (1) Select Sheet1!B2. (2) Group Sheet1 with the worksheets Sheet2, Sheet3 and Sheet4 by holding down Ctrl and clicking on the tabs of the sheets to group them. (3) Press the F2 key, then immediately press Enter to copy the formula in Sheet1!B2 across the grouped sheets.

Remember to ungroup the sheets afterwards! Right-click on any tab and choose Ungroup Sheets to do that.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.