View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default source sheet name as a wild card

My guess is the answer to your question lies in the code you did not show
us. Neither Get_File_Names nor Get_Sheet are built into VB, so I am guessing
they are subroutines that are being called upon to do the "real" work of
your code... we would need to see their code.

--
Rick (MVP - Excel)


"James" wrote in message
...
I was working on this late last night, than I remembered Ron de Bruin page
and he had some written for what I needed. I need a small modification on
this code. In the SourceShName line I have it pulling all sheets with the
name "Report", but some are my sheet names are called "Report 1, Report
2..."
How can I make it look for anything called Report* or something like that.

Sub RDB_Copy_Sheet()
Dim myFiles As Variant
Dim myCountOfFiles As Long

myCountOfFiles = Get_File_Names( _
MyPath:="H:\myprojdir\GWIS\Humble\Test\part2", _
Subfolders:=True, _
ExtStr:="*.xl*", _
myReturnedFiles:=myFiles)

If myCountOfFiles = 0 Then
MsgBox "No files that match the ExtStr in this folder"
Exit Sub
End If

Get_Sheet _
PasteAsValues:=True, _
SourceShName:="Repor*", _
SourceShIndex:=1, _
myReturnedFiles:=myFiles

End Sub

Thanks