Solved

Remove Open Workbook formula

Posted on 2011-02-21
7
232 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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 500 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

813 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now