Format(Time, "h.mm AM/PM") question

N

Nicole Seibert

Here is the code:

'This is the name of the workbook with transferred data. This allows a
date/time stamp in the name.
wbname = "TERData " & Format(Date, "mm-dd-yyyy") & " " & Format(Time,
"h.mm AM/PM")

It stops on the word: TIME. why? This has worked for weeks and today it
stopped working. I can't see anything that I changed in this line that would
affect the outcome except I moved the code from a private open workbook macro
into my private stash to test the email functionality on select memebers of
my team.

Here is a section of my log that also captures date and time the same way.
You can see how the code use to work and now doesn't as the time switches to
12am and doesn't move forward:

TERData 42 7/5/2006 8:54:39 AM
TERData 43 7/5/2006 8:55:16 AM
TERData 44 7/5/2006 12:00:00 AM
TERData 45 7/5/2006 12:00:00 AM
TERData 46 7/5/2006 12:00:00 AM
 
B

Bob Phillips

You haven't created a variable called TIME have you?

Another thing to try. In the VBIDE, go to Tools>References. If there are any
items with MISSING in the text, uncheck them.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
N

Nicole Seibert

No, I didn't create a variable called time. I checked my reference for
"missing" entries and found none. And interestingly enough the error message
I get states:

"Compile error: expected function or variable"
 
A

Andrew Taylor

This might not help the problem, but you can simplify the
code slightly by writing:

wbname = "TERData " & Format(Now, "mm-dd-yyyy h.mm AM/PM")
 
N

Nicole Seibert

Thank you Andrew.

Andrew Taylor said:
This might not help the problem, but you can simplify the
code slightly by writing:

wbname = "TERData " & Format(Now, "mm-dd-yyyy h.mm AM/PM")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top