Remove Open Workbook formula

Hi,

Im looking for a piece of code that i could assign a macro too which can remove some another piece of code.

So i have a report that turns from a master file to a dated file (via a macro button) e.g. MasterReport.xls to 18/02/2010.

Once changed to the date file, i want to remove this piece of code in the open workbook

Private Sub Workbook_Open()
AllWorkbookPivots
End Sub


What piece of code could i use to remove that code!

Thanks
Seamus
Seamus2626Asked:
Who is Participating?
 
Rory ArchibaldConnect With a Mentor Commented:
Do you have access to the VBProject trusted?
0
 
Rory ArchibaldCommented:
Is that the only code in the ThisWorkbook module of the workbook?
0
 
Seamus2626Author Commented:
Sure is......
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Rory ArchibaldCommented:
With Workbooks("blah.xls").VBProject.VBComponents("ThisWorkbook").Codemodule
   .DeleteLines 1, .CountOfLines
End With

Open in new window


You need to have access to the VBProject trusted.
0
 
Seamus2626Author Commented:
Hey Rory, got the attached error message on running this
Doc1.doc
0
 
Seamus2626Author Commented:
Sorry Rory, just seen the bottom part of your response.....
0
 
Seamus2626Author Commented:
Sorted, thanks!!

Seamus
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.