Kamis, 19 Mei 2011

Re: [ExcelVBA] Uploading file with date and time in name

 

You are right I just messed up the names. There are 4 files that I upload using
this macro and I used the wring name. The file and code name are the same.

20110519_234845.NURSESTATPROV.txt

________________________________
From: David Smart <smartware.consulting@gmail.com>
To: ExcelVBA@yahoogroups.com
Sent: Thu, May 19, 2011 5:56:28 PM
Subject: Re: [ExcelVBA] Uploading file with date and time in name

 
Mark

It's probably just an inconsistency in your e-mail, but you are talking
about a file called

20110519_234845.HOSPSERVPROV.txt

but your code talks about files called

[date/time].NURSESTATPROV.txt

and

[date/time].NURSESTATPARK.txt

I.e. the text part of the file name is different.

=======================================

As a general programming guide, do not do things like

... Connection:= _
"TEXT;T:\Admin\Fin\ProvFin\SHARED\Census Data\" & z &
".NURSESTATPARK.txt"

Instead do things like

Dim FileName as String: FileName = "T:\Admin\Fin\ProvFin\SHARED\Census
Data\" & z & ".NURSESTATPARK.txt"
Call MsgBox (FileName)
.... Connection:= "TEXT;" & FileName

Even if you don't have the MsgBox call, you can inspect the file name at a
breakpoint before you inflict it on the operating system. That way you can
compare apples (your MsgBox) with apples (the Explorer window of
T:\Admin\Fin\ProvFin\SHARED\Census Data\).

Most problems like this are because you are not generating the file name
that you thought you were.

Of course, you'll comment out the MsgBox call once the code works.

Regards, Dave S

----- Original Message -----
From: "Mark Bacheldor" <m_bacheldor@yahoo.com>
To: <ExcelVBA@yahoogroups.com>
Sent: Friday, May 20, 2011 12:58 AM
Subject: Re: [ExcelVBA] Uploading file with date and time in name

John,

Sorry I am getting a run time error 1004

The file could not be accessed.

20110519_234845.HOSPSERVPROV.txt

This is the new file name but I am not seeing any colons. I did copy the
_234845, which is the time stamp and pasted that to the module.
"_234845.HOSPSERVPROV.txt" this worked but I need the macro to grab the file
just based on the date and the HOSPSERVPROV.txt portion.

I hope I am being clear but if not let me know and I will give it anopther
try..

Thanks,

Mark

________________________________
From: Dr John C Bullas <john.bullas@gmail.com>
To: ExcelVBA@yahoogroups.com
Sent: Thu, May 19, 2011 10:22:57 AM
Subject: Re: [ExcelVBA] Uploading file with date and time in name

Any error messages?
is it failing to save or just failing

remember the time includes a ":" which is incompatible with fillename
conventions

On 19 May 2011 15:16, m_bacheldor <m_bacheldor@yahoo.com> wrote:
> Good Morning,
>
> I have a macro that I wrote and it had been working fine until the file
> name
>was changed to include the time. Below is the code and file name that
>worked
>previously.
>
> Sub Upload()

[Non-text portions of this message have been removed]

------------------------------------

----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go
here: http://www.mousetrax.com/techtrax to enter the ezine, then search the
ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------Yahoo! Groups Links

-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1325 / Virus Database: 1509/3646 - Release Date: 05/18/11

[Non-text portions of this message have been removed]

__._,_.___
Recent Activity:
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------
MARKETPLACE

Get great advice about dogs and cats. Visit the Dog & Cat Answers Center.


Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar