[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Remove Open Workbook formula

Posted on 2011-02-21
7
Medium Priority
?
240 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:Seamus2626
  • 4
  • 3
7 Comments
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 34944419
Is that the only code in the ThisWorkbook module of the workbook?
0
 

Author Comment

by:Seamus2626
ID: 34944433
Sure is......
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 34944503
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:Seamus2626
ID: 34944545
Hey Rory, got the attached error message on running this
Doc1.doc
0
 

Author Comment

by:Seamus2626
ID: 34944601
Sorry Rory, just seen the bottom part of your response.....
0
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 2000 total points
ID: 34944608
Do you have access to the VBProject trusted?
0
 

Author Closing Comment

by:Seamus2626
ID: 34944628
Sorted, thanks!!

Seamus
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question