View Full Version : Question about references....
JohnnyBravo
07-30-2009, 02:08 AM
My questions are more general VBA questions. This is the best subforum I could find to post my questions. I'm a VBA newbie so please bear with me. I just read about references in a VBA beginners book and I would like to know the following. First of all, these references that are built into VBA - what are they for? In the attached screenshot, there's a whole list of applications (some external to MS Office) - are these all the applications that VBA can interact with?
A:
If I write a VBA script in Word, and it has something to do with importing data into Excel, do I have to click on Excel object library?
B:
I'm very interested in making Word VBA interact with Adobe Acrobat. I have the free version of Acrobat Reader v8. In the screenshot, which one do I choose? And also does it matter that I have v8 and the references library has only v7 listed?
And finally, why is Visual Basic for Applications listed 5 times? (see bottom of screenshot).
http://www.pixhost.org/show/92/521252_vba_references.png
http://www.pixhost.org/show/92/521252_vba_references.png
Edit Lucas: I attached your picture to your post
lucas
07-30-2009, 08:08 AM
As far as the references there are two ways to do it. Late binding and early binding. In one you have to set the reference in the file that runs the code(early) and in the other the code does it for you. There are advantages and disadvantages to both. You said you wanted to understand so here are a few links for you to get started with.
http://www.dicks-clicks.com/excel/olBinding.htm
http://www.vbaexpress.com/forum/showthread.php?t=19366&highlight=late+bound+binding
http://word.mvps.org/fAQs/InterDev/EarlyvsLateBinding.htm
fumei
07-31-2009, 10:10 AM
IMO, there are far more advantages to using early-binding.
I have no idea why there would be five listings for VBA. Seems odd.
A: if you want to use early-binding, yes you need the Reference to Excel.
B: if you just have Reader, I am not sure how much interaction is possible. What, exactly, do you want to do?
JohnnyBravo
07-31-2009, 02:25 PM
Lucas, thanks for the links. I just had an unexpected emergency come up so I'll read in more detail later.
B: if you just have Reader, I am not sure how much interaction is possible. What, exactly, do you want to do?
Fumei,
Nothing fancy. I have some special installed on my computer that allows me to convert any document (including Word files) into PDF. Many times in Word, I'll make changes to my resume and in the Print dialog box that pops up, I choose the Ghost PDF printer and when I click 'Print', the result is a PDF version of my resume located in "x:\Stuff\Converted PDFs\Microsoft Word - Resume_John.doc.pdf" (Notice by the way, the software recognizes what application the file was originally created from - look at the file name)
The software is configurable. I could change it to any directory I wish but not every Word document is a resume and I want to leave it at it's current output path. Besides changing the configuration (ouput path) is not the most user friendly and there are several steps to jump through. Yes I know there might be better PDF making software available but I've been using this for years and the resulting PDFs look so darn crisp I love it.
Basically I was exploring the option of how to write a VBA routine that would:
1) Assign a keystroke combination so that when it is activated, it would automatically print to the "Ghost PDF" printer. Very easy. Even a simple recorded macro would suffice. But then afterwards:
2) Go retrieve the converted document from the output path (as I've typed above) and move it to: "x:\John\Technical Resumes" and then get rid of all the extra junk in the file name.
Microsoft Word - Resume_John.doc.pdf becomes ===> Resume_John.pdf
3) Finally, is it possible to have VBA fire up Acrobat Reader so that it will open up the converted PDF automatically? If not, that's OK.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.