From: fishy on 14 Apr 2010 11:30 Yes, this remains constant, only the date then time is variable after the underscore. R "Stuart McCall" wrote: > > "fishy" <fishy(a)discussions.microsoft.com> wrote in message > news:CCE95E35-AFFD-472F-AB28-4F308A9F42F2(a)microsoft.com... > > > > Apologies, the date/time stamp is of the format > > > > ICM_AMS_MS_Call_Stats_YYYY-MM-DD_HH-MM-SS.csv > > > > This therefore means that I am getting a bad filename error. > > > > I thought I could get away with changing this to wildcards ie > > > > ICM_AMS_MS_Call_Stats_****-**-**_**-**-**.csv > > > > But this doesnt work. > > > > Any ideas? > > Is the part "ICM_AMS_MS_Call_Stats" always the same? If not, does it ever > contain a number? > > > . >
From: Stuart McCall on 14 Apr 2010 12:37 "fishy" <fishy(a)discussions.microsoft.com> wrote in message news:CFCE53DA-2A9A-49D5-BB84-29C4F337A347(a)microsoft.com... > Yes, this remains constant, only the date then time is variable after the > underscore. > > R No problem, then. Dim strOldName As String, strNewName As String Dim strPath As String, i As Long strPath = "C:\Temp\" 'Change this to the correct path strOldName = "ICM_AMS_MS_Call_Stats_01011901000000.csv" For i = 1 To Len(strOldName) If IsNumeric(Mid$(strOldName, i, 1)) Then Exit For End If Next strNewName = Left$(strOldName, i - 2) Kill strNewName Name strPath & strOldName As strPath & strNewName What the above code does is to look down the string till it finds a numeric character, then assigns the leftmost part of strOldName (minus the numeric and the underscore) to strNewName. Then it deletes ICM_AMS_MS_Call_Stats because it'll always be the same name. Then it renames the file as you require. The above is untested because I have to rush out. Hope it helps you. > > "Stuart McCall" wrote: > >> >> "fishy" <fishy(a)discussions.microsoft.com> wrote in message >> news:CCE95E35-AFFD-472F-AB28-4F308A9F42F2(a)microsoft.com... >> > >> > Apologies, the date/time stamp is of the format >> > >> > ICM_AMS_MS_Call_Stats_YYYY-MM-DD_HH-MM-SS.csv >> > >> > This therefore means that I am getting a bad filename error. >> > >> > I thought I could get away with changing this to wildcards ie >> > >> > ICM_AMS_MS_Call_Stats_****-**-**_**-**-**.csv >> > >> > But this doesnt work. >> > >> > Any ideas? >> >> Is the part "ICM_AMS_MS_Call_Stats" always the same? If not, does it ever >> contain a number? >> >> >> . >>
From: fishy on 16 Apr 2010 03:20 This is debugging at the kill function as its trying to kill the new named file. "Stuart McCall" wrote: > "fishy" <fishy(a)discussions.microsoft.com> wrote in message > news:CFCE53DA-2A9A-49D5-BB84-29C4F337A347(a)microsoft.com... > > Yes, this remains constant, only the date then time is variable after the > > underscore. > > > > R > > No problem, then. > > Dim strOldName As String, strNewName As String > Dim strPath As String, i As Long > > strPath = "C:\Temp\" 'Change this to the correct path > strOldName = "ICM_AMS_MS_Call_Stats_01011901000000.csv" > > For i = 1 To Len(strOldName) > If IsNumeric(Mid$(strOldName, i, 1)) Then > Exit For > End If > Next > strNewName = Left$(strOldName, i - 2) > > Kill strNewName > Name strPath & strOldName As strPath & strNewName > > What the above code does is to look down the string till it finds a numeric > character, then assigns the leftmost part of strOldName (minus the numeric > and the underscore) to strNewName. > > Then it deletes ICM_AMS_MS_Call_Stats because it'll always be the same name. > Then it renames the file as you require. > > The above is untested because I have to rush out. Hope it helps you. > > > > > "Stuart McCall" wrote: > > > >> > >> "fishy" <fishy(a)discussions.microsoft.com> wrote in message > >> news:CCE95E35-AFFD-472F-AB28-4F308A9F42F2(a)microsoft.com... > >> > > >> > Apologies, the date/time stamp is of the format > >> > > >> > ICM_AMS_MS_Call_Stats_YYYY-MM-DD_HH-MM-SS.csv > >> > > >> > This therefore means that I am getting a bad filename error. > >> > > >> > I thought I could get away with changing this to wildcards ie > >> > > >> > ICM_AMS_MS_Call_Stats_****-**-**_**-**-**.csv > >> > > >> > But this doesnt work. > >> > > >> > Any ideas? > >> > >> Is the part "ICM_AMS_MS_Call_Stats" always the same? If not, does it ever > >> contain a number? > >> > >> > >> . > >> > > > . >
First
|
Prev
|
Pages: 1 2 Prev: Multiselect in datasheet view? Next: Problems adding new record from form / subform |