I currently have a macro that goes out to a website and enters some data and runs a report. This report is downloaded and opened as an excel file. Once the file is open I need to copy the data from it and input into another spreadsheet i have where the data is configured. The problem I am running into is the file is always opened with a slight change in the name.

Example: Trendplus[1].xls, Trendplus[2].xls, Trendplus[3].xls

The only difference is the number between the brackets. I would like to be able to use a wildcard after Trendplus so I can copy the data form that file then close it out.

Sub Fraudchronicle()

'Turn off the display messages, like are you sure you want to save.

'Ensure that the internet explorer references are added. (shdocvw.dll)
'Define Variables

Dim ie As Object
Dim Chr As String
Dim CTP As String

'Set the chronicle spreadsheet to a string so that you do not have to type in the name over and over again.

Chr = "Chronicle Trend Plus.xls"            'Chronicle Spreadsheet being updated.
CTP = "TrendPlus[?].xls"                    'Chronicle spreadsheet opened by webpage

'Launch Internet Explorer

Set ie = CreateObject("INTERNETEXPLORER.APPLICATION")

'If you want to see Internet Explorer work.
ie.Visible = True

'go to webpage.

ie.Navigate "website.com"

'keep looping until the webpage loads

While ie.Busy
DoEvents
Wend

'***Time to set your vaules on the drop down and input boxes and select your things. Must view source code of webpage to determine
'***element names and value names.

'Select the Call type.

ie.Document.getElementById("lstBxCallType").Value = "18"                       'Selects ASG

'Select the Report Style

ie.Document.getElementById("drpReportStyle").Value = "DAILY - SINGLE MONTH"     'Selects which report style you want.

'enter the first day of the month you want to see

ie.Document.getElementById("txtDate").Value = Format(Date, "7/1/2010")          'Enters date, must format as a date for website to understand.

'Select the checkbox to export to excel document

ie.Document.getElementById("chkExcel").Checked = True                           'Checks the box for excel format.

'click the Go button

ie.Document.getElementById("btnGo").Click                                       'clicks the go button

'copies the exported data into the Chronicle Spreadsheet.

While ie.Busy
DoEvents
Wend

Windows(CTP).Activate
ActiveSheet.UsedRange.Copy

'Pastes the data in the chronicle spreadsheet
Windows(Chr).Activate
Sheets("ASG").Range("A1").PasteSpecial Paste:=xlPasteValues

'Clears the  variables and closes internet explorer so you can run it again for a differnt report.

ie.Visible = False

Set ie = Nothing

End Sub