UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Fso.copyfile With Wildcard, Access 2010    
 
   
AAJONES3
post Mar 26 2020, 01:43 PM
Post#1



Posts: 15
Joined: 4-October 19



I'm running the following code but it's not understanding the correct source file. My source file is \\CCX.abc.com\Shares\Open_2020-03-26_10-02-PM.xlsx

Dim strBasePath As String
Set fso = CreateObject("Scripting.FileSystemObject")
strFilter = Format(Now(), "yyyy-mm-dd") & "_10" & "*AM.xlsx"
strSourceFile = "\\CCX.abc.com\Shares\Open_" & strFilter
strDestinationPath = "C:\Users\Public\Sources\Open10am.xls"
Call fso.CopyFile(strSourceFile, strDestinationPath)

If I put a msgbox to recall what the strsourcefile is, it's including the * as a string rather than wildcard: \\CCX.abc.com\Shares\Open_2020-03-26_10*AM.xlsx iconfused.gif

Go to the top of the page
 
esancha
post Mar 26 2020, 03:39 PM
Post#2



Posts: 94
Joined: 4-October 14
From: Spain


Hi!
As indicated by the FileSystemObject help Wildcard characters can only be used in the last path component of the source argument. For example, you can use:

fso.CopyFile "c:\misdocumentos\*\R1???97.xls", "c:\temp"

Regards
This post has been edited by esancha: Mar 26 2020, 03:40 PM

--------------------
Kind Regards
Emilio Sancha
MS Access MVP 2006-2011
http://www.mvp-access.es/emilio/
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    25th May 2020 - 03:48 AM