File referencing in vba

5 pts.
Tags:
Microsoft Word
VBA
VBA Referencing
Hi All. I have a user form in Word that populates a doc, saves as a temp file, emails as attachment and then kills the temp file. I am worried that with momre than one user at any one time one person's code might kill another person's temp file before they have sent it. Any ideas as to how I might create a unique filename each time or other suggestions would be most helpful.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Without more information on how your creating the temp file I wouldn’t be able to be sure this answer helps you.

But try adding the Date and time to the filename for the temp file like so, assuming your filename variable is “filename”:

filename = Year(Now) & “-” & Month(Now) & “-” & Day(Now) & “-” & Hour(Now) & “-” & Minute(Now) & “-” & Second(Now) & “-” & Rnd(100) & “-” & filename

It’s quick and dirty, but should work.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following