This is my first very first answer, so do not be surprised if I am wildly wrong!  8^)
 
If you used Format(Now - 27, "MMMYY") it would return the three character month and year -- FEB05.  Also, using 27 will account for short months such as February. Not as elegant as Dwight's solution, but it should work.
 
Dave
 

Dave Dickens
Systems Analyst 3
SIEMENS Medical Solutions - Health Services
Charleston Area Medical Center
Phone: (304) 388-7357
Fax: (304) 388-9090
[EMAIL PROTECTED]

-----Original Message-----
From: MORRILL,DENISE [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 24, 2005 16:04
To: [email protected]
Subject: RE: [Talk] VB 101

Many thanks for the rapid responses!  I used  Chris's suggestion and it works great.
Thanks again!
Denise
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Rich McNeil
Sent: Thursday, March 24, 2005 3:37 PM
To: [email protected]
Subject: FW: [Talk] VB 101

 

 

Rich McNeil

Boston Software Systems

866 653 5105

www.bostonworkstation.com


From: Lombard, Christopher [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 24, 2005 3:29 PM
To: Rich McNeil
Subject: RE: [Talk] VB 101

 

That won't work if the program is running on the 31st.  I'd respond to the Listserv, but for some reason my message got returned to me.

 

You can do the follow

 

SendKeys "C:\Meditech Archvies\" & Format(Now()-CInt(Format(Now(),"dd")),"mm") & Format(Now(),"yyyy") & ".txt"

 

Now() - CInt(Format(Now(),"dd")) will take today's date and minus the day.  If today was March 3rd, 2005 and you minus three, then you would get the previous month - February 28th, 2005.

 

This is how I'd do it, but someone else might have an easier way.

 

Bonus:

 

Format(Now()-CInt(Format(Now(),"dd")),"mmm") & Format(Now(),"yyyy")

 

Use: mmm for short month (Feb) or mmmm for long month (February)

 

Chris Lombard

Bay Medical Center

 

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rich McNeil
Sent: Thursday, March 24, 2005 2:23 PM
To: [email protected]
Subject: RE: [Talk] VB 101

 

Try Now - 30 for the date

 

Rich McNeil

Boston Software Systems

866 653 5105

www.bostonworkstation.com


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of MORRILL,DENISE
Sent: Thursday, March 24, 2005 3:12 PM
To: Boston Workstation Talk (E-mail)
Subject: [Talk] VB 101

 

This is probably very basic....

 

I am downloading a report at the beginning of every month for last month's data.  I want to name the file to be last month's name, so that if I were downloading a report on March 1st, 2005, the file name would be 022005.txt.

 

The following code:

 

SendKeys "C:\Meditech Archives\" & Format(Now(), "mmyyyy") & ".txt"

 

recognizes that today is March whatever and gives me 032005.txt.  How can I tell it to use LAST month's designation?

 

Bonus question - how would I tell it to use the name (February) of the month vs. the month number?

 

Many thanks in advance!

Denise

 

Denise Morrill

Senior Systems Analyst

Spring Harbor Hospital

123 Andover Rd

Westbrook, ME  04092

 

207.761.2265

[EMAIL PROTECTED]

 


CONFIDENTIAL NOTICE: This email message, including
any attachments, is intended only for the use of the
intended recipient(s) and may contain information that
is privileged, confidential and prohibited from
unauthorized disclosure under applicable law. If you
are not the intended recipient of this message, any
dissemination, distribution or copying of this message
is strictly prohibited. If you received this message in
error, please notify the sender by reply email and destroy
all copies of the original message.

Spring Harbor Hospital Maine's Mental Health Network


CONFIDENTIAL NOTICE: This email message, including
any attachments, is intended only for the use of the
intended recipient(s) and may contain information that
is privileged, confidential and prohibited from
unauthorized disclosure under applicable law. If you
are not the intended recipient of this message, any
dissemination, distribution or copying of this message
is strictly prohibited. If you received this message in
error, please notify the sender by reply email and destroy
all copies of the original message.

Spring Harbor Hospital Maine's Mental Health Network

Reply via email to