running macros in downloaded files

B

blueshot

Daily I have to access an .xls file that downloads from the internet
with a different filename each time.

I want to write a macro that will delete info that I don't need and
adjust formatting that I want for this file. I think I can come up
with the meat of the code but how do I get it to work on the downloaded
file each time I download it?

I would prefer that it didn't change the file instantaneously as I
would like to verify the file first. I would like a command button to
pop up to start the process. Am I wishing for too much? I am not a
very good programmer yet so please keep that in mind when proposing
suggestions.

Thank you all very much!
 
R

Rob van Gelder

You're talking about an Excel Workbook, with some macros, that at the push
of a button opens and formats another workbook.

From what I gather, you may already have the workbook open.

Here's something to work with:
Sub testit()
Dim wkbDest As Workbook

On Error GoTo e
Set wkbDest = Workbooks("Book2.xls")
On Error GoTo 0

With wkbDest.Worksheets(1)
.Rows(1).Interior.ColorIndex = 34
End With

Exit Sub

e: Workbooks.Open "C:\T\Book2.xls"
Resume
End Sub
 
Top