Microsoft Excel Compile Error Can T Find Project Or Library

Posted on

Compile Excel workbook to EXE file. Looking for simple Excel Compiler? Visit xlCompiler website. Compile Excel workbook to standalone application.

In this post we will learn how to use the Advanced Filter option using VBA to allow us to filter our data on a separate sheet. This has been requested by a lot. During your work week, there are probably lots of times that you find yourself copying and pasting information from Excel into Word, or the other way around. If you are looking for a quick summary then.

Export an Excel Chart to Power. Point. You can use VBA to streamline a lot of your day- to- day practices, eliminate boring tasks, and reduce tedium.

Microsoft Excel Compile Error Can T Find Project Or Library

A great example of a VBA project that would save a lot of time is report generation in Word or Power. Point based on Excel content.

Of course, such a project is more advanced than simply recording and replaying macros would be. I’ll use the small task of exporting an Excel chart to Power. Point to illustrate such inter- application automation, and I’ll follow up soon with more intricate routines that accomplish more tasks. Export an Excel Chart to Word shows a similar example that exports an Excel chart to Word. There are a number of things you need to understand: Excel’s Object Model.

Power. Point’s (Word’s, etc.) Object Model. Early and Late Binding, References, Libraries. We can learn all about Excel’s object model by recording macros and examining the code, as well as using tools like Intelli. Sense and the Object Browser in the VB Editor. And there’s always Google at our disposal. Search on “Excel VBA” and the particular keyword that has you stumped, or type the exact error message into the search box. We learn about another application’s object model through VB Editor tools and of course Google.

Power. Point has Charts, Shapes, and Tables like Excel does; Power. Point’s charts and shapes behave much like Excel’s, but its tables are much different. And Power. Point has Presentations and Slides instead of Workbooks and Worksheets. I’ll cover Early and Late Binding briefly, so that you can get up and running.

Early and Late Binding. When you write code, you are making use of code libraries, which contain the objects, methods, properties, and other keywords for the language you are using. For example, if you are writing Excel VBA code, you are using the Visual Basic for Applications library, the Microsoft Excel Object Library, the Microsoft Office Object Library, and others. In the VBA Editor, these libraries enable Intelli.

Sense, which are the smart tooltips and dropdown boxes that help you get the code written quickly. Early Binding. Early Binding is when you ensure that all libraries used in your project are explicitly identified when you are writing the code (at “design time”), by setting a reference to the library in your project (“binding” it to the project). Early Binding enables design tools (Intelli.

Sense, the Object Browser, etc.) in the VBA Editor to access an external library, so you can write your code more quickly. Intelli. Sense Tool.

Tip Showing Relevant Syntax. Intelli. Sense Dropdown Listing Appropriate Options. Early Binding also saves time by telling the system what library to use, instead of making the system look up all the possible libraries and guess which one to use. In practice, I haven’t found this delay to be significant.

If I use Early Binding, and share my program with others, they must have all of the referenced libraries on their computer, or the language (i. VBA) has to be able to figure out which library to use instead. For example, if I program in Excel 2. Excel 2. 01. 6 and Office 2. VBA is smart enough to use the relevant versions of the Excel and Office libraries if someone uses the project in an older or newer version of Excel.

If I set a reference to Power. Point 2. 01. 6, however, VBA isn’t so smart. It will successfully use a newer version of the Power.

Point library, but if the user has an older version, he will get a compile error, and nothing will run. Late Binding. Late Binding is when you don’t explicitly bind libraries to your project at design time, but instead let your program try to figure it out later (at “run time”). Late Binding doesn’t help you find information via Intelli.

Sense or the Object Browser, so development may be slower. If a needed library is not present on the user’s computer, and you have used Late Binding, you still get an error if the system can’t find the library. However, it’s not a compile error; it’s a run- time error, and you can write code to handle it gracefully. I believe there are some libraries which do not work unless they are specifically bound to the project that uses them, but everything I’ve needed for routine VBA automation has worked fine with Late Binding. What Should I Use? There are tradeoffs between Early and Late Binding.

Intelli. Sense and other guidance that is made available by Early Binding is invaluable. On the other hand, the compile errors due to missing references are catastrophic. Many developers will use Early Binding while developing their code, setting the references they need; once the code is ready to ship, they switch to Late Binding, removing the references and making the other small changes to avoid compile errors in the code. The Example Project. Here is a simple data set and chart in Excel. Here is a blank slide in Power. Point. We’re going to export that chart from Excel onto that Power.

Point slide. Early Binding – Setting References. Download Do Jogo Pokemon Ruby Para Ps2 For Sale. To set a reference to an external library, go to the VB Editor and make sure the project you’re working on is the active project. Go to the Tools menu > References, and the References dialog appears.

This dialog lists each open workbook and add- in, as well as all libraries installed on your system. This includes many that are not appropriate for VBA development, and using these may result in spectacular system failures. But any of them may one day come in handy. For example, long ago I used the Win. Amp library (remember that?

In this view you can see that the Microsoft Power. Point 1. 6. 0 Object Library has also been checked.

If it’s not checked and you haven’t used it recently, you’ll have to scroll down until you find it, then check it. These library references are only set for the active VB project. Other projects may have different libraries referenced.

For example, I used two workbooks while working on this tutorial: one with the Power. Point library checked for Early Binding, the other without for Late Binding. Outline of Our Procedure. Here is the entire VBA procedure that will export the active Excel chart to Power. Point. The code is organized like this: We have declared several object variables at the top of the procedure. The chart is pasted as a Shape, and we make it a member of a Shape.

Range to align it within the slide. I’ve shown the Early Binding Power.

Point object types below; in Late Binding, these are all plain old Objects. If he has not, we pop up a message reminding him to select one next time. We wrap it in On Error statements so we don’t get an error if it’s not running. If it’s not running, ppt. App is in fact Nothing, so we use Create. Object to start it up.

We could be lazy and simply use Create. Object, and it will fetch the running instance or fire up a new one as needed. But what I have used is generally the proper way to do it, and it doesn’t hurt if we go through all the motions even if we don’t always need to. At this point, it would be wise to test that we were able to start up Power. Point. If we couldn’t start Power.

Point, for example, if Power. Point were not installed on the computer, we would have to abandon the procedure without trying to use the various Power. Point objects later in the code. We should also alert the user so he could rectify the situation.

Get the Power. Point Presentation and Slide. Active. Presentation is probably obvious enough. If there is one, continue; otherwise create one first. Active. Slide is a tough one, because even though such an object would be useful, there is no Active. Slide object in Power. Point. The first thing you must check is whether the active presentation has any slides. Sounds dumb, but in prior versions of Power.

Point, when you created a new presentation, it started out with no slides, and you had to click in the window to insert the first slide. Presentations. Add also inserts a new presentation with no slides. So we need to add a slide to a new presentation and to an existing presentation that had no slides yet.