I've only just seen this thread.
Is everything now working as expected?
I ask because there's a few things in the code that should be avoided, especially when automating Excel from another application.
The main thing is the use of ActiveCell/Select/Selection etc.
For example this,
MyBook.Activate
Excel.Range("F2").Select
Excel.ActiveCell.Value = "Report Date: "
Excel.ActiveCell.Offset(1, 0).Select
Excel.ActiveCell.Value = "Report Title: "
Excel.ActiveCell.Offset(1, 0).Select
Excel.ActiveCell.Value = "Resource Name: "
Excel.ActiveCell.Offset(1, 0).Select
Excel.ActiveCell.Value = "Reporting Period: "
could be done like this.
With MyBook.ActiveSheet.Range("F2")
.Value = "Report Date: "
.Offset(1, 0).Value = "Report Title: "
.Offset(2, 0).Value = "Resource Name: "
.Offset(3, 0).Value = "Reporting Period: "
End With
Instead of MyBook.ActiveSheet you could use MySheet, which is declared earlier in your code, but you would need to set it to reference the relevant worksheet.
Anyway, your code might work just fine as it is but it might be worth updating it.
Bookmarks