PDA

View Full Version : Display current time on a form in a Mac



Aussiebear
05-20-2015, 08:57 PM
Can one display the current time on a form within Mac Excel?

SamT
05-20-2015, 09:41 PM
IF you can display on a worksheet on a Mac, you should be able to do it on a form. In both cases. It is just a text string. and all standard Form controls display text either as a String value or a Variant Value.

Aussiebear
05-21-2015, 03:26 AM
Don't know if that is possible Sam. I've spent the last few hours searching the internet and they talk about putting a time in a worksheet but not a form.

Paul_Hossler
05-21-2015, 06:31 AM
I would expect that the WS formula NOW() would recalculate whenever the WB was recalculated, but a UF string that was initially set would not automatically update

You should be able to grab the time and put it on the UF when you .Activate it, but you would have to manually cause it to update (via .OnTime??)

No Mac to experiment with

SamT
05-21-2015, 07:55 AM
Are you asking for a digital clock kinda thingy?

filipebessa9
05-21-2015, 07:56 AM
Hi everyone, Im so sorry for asking here but I don't seem to actually be able to create a post, how does that work?

It keeps coming up with a message about URL's etc...

SamT
05-21-2015, 10:29 AM
One has to have at least 5 posts to use URL.s and atachments. You need to use the Go Advanced Editor to attach files.

You can post your code by clicking the # icon on the editor, then Copy and Paste your code between the CODE tags

Aussiebear
05-21-2015, 06:31 PM
Yes Sam a digital clock is preferred.

SamT
05-21-2015, 07:45 PM
Here's seven. Take your pick.

Aussiebear
05-21-2015, 11:04 PM
Thank you Sam

Aussiebear
05-21-2015, 11:05 PM
I would expect that the WS formula NOW() would recalculate whenever the WB was recalculated, but a UF string that was initially set would not automatically update

You should be able to grab the time and put it on the UF when you .Activate it, but you would have to manually cause it to update (via .OnTime??)

No Mac to experiment with

All I am chasing is the current system time.....

Aflatoon
05-22-2015, 02:17 AM
Do you want it updating in real time? (if so, what precision - minutes? Seconds?)

Aussiebear
05-22-2015, 02:29 AM
Minutes only. it will form part of the main screen so the operator will see day of week, actual date and the time.

Aflatoon
05-22-2015, 02:53 AM
I think the only way you can do it is with DoEvents in a loop (OnTime won't run):


private sub userform_activate()
runtimer
end sub

sub runtimer()
do
doevents
me.label1.caption = now
doevents
loop
end sub

SamT
05-22-2015, 08:55 AM
OnTime won't run on a Mac? I have PC, so can't know.

Didyou pout the OnTime sub in a module and call it from the Form? I had to do that one the Clock I built in
Calculate hours (http://www.vbaexpress.com/forum/showthread.php?52640-Calculate-hours).

Aflatoon
05-22-2015, 09:47 AM
I know. ;)

OnTime won't run because the form is loaded. (and you can't load it modelessly on a Mac).

SamT
05-22-2015, 10:45 AM
Do you mean that you can't call a standard module procedure with OnTime on a Mac if a UserForm is Loaded?

Can you Load two Forms at the same time?

Aflatoon
05-22-2015, 02:47 PM
Do you mean that you can't call a standard module procedure with OnTime on a Mac if a UserForm is Loaded?

Yes.


Can you Load two Forms at the same time?

Yes you can.

SamT
05-22-2015, 02:54 PM
That makes a difference. Maybe we ought to get Aussie a PC laptop for Christmas.

Aussiebear
05-22-2015, 04:28 PM
I've passed the hat round here at home and all I got was a "No" from the bride.