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    
post Mar 26 2020, 01:43 PM

Posts: 16
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
post Mar 26 2020, 03:39 PM

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

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"

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

Kind Regards
Emilio Sancha
MS Access MVP 2006-2011
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    2nd July 2020 - 05:56 PM