Print this page | Go back to previous topic | Forum name | The Computer Forum | Topic subject | VBA GetFile in MS Word | Topic URL | http://www.pcqanda.com/dc/dcboard.php?az=show_topic&forum=2&topic_id=385547 |
385547, VBA GetFile in MS Word Posted by _Chewy_, Tue Oct-25-05 02:05 AM
Steve,
Back to my RFI project again using the form letter that I mentioned in my previous thread. What I want is VBA to look at a series of words contained within a Bookmark range called "Transplant Types" (located at very end of paragraph 1). So if ABC Hospital specializes in Adult Heart and Adult Liver, I want VBA to go to a specific folder, retrive word files named "Section 1 Heart.doc" and "Section 4 Liver.doc". Of course depending the hospital's specialty, I want it to retrieve the correct word documents. There are about 10 different types in all.
Tonight I fooled around with the VBE help file menu but I'm gettin nowhere. I took bits and pieces of code I found on the internet in a vain attempt to try to do this w/out any expert help. I think it's getting caught up on the GetFile command. I keep getting an error message "Requested member of the class or object cannot be found" or something like that.
I'm lost - can you point me in the right direction?
|
385601, RE: VBA GetFile in MS Word Posted by SteveYandl, Tue Oct-25-05 01:23 PM
For what I think you want to do, it might be simpler to use the 'Documents.Open' rather than GetFile.
GetFile is a member of the FileSystemObject which is part of the scripting runtime. In short, it isn't part of VBA. If you want to use it in a VBA project, open the VBE, click 'Tools > References' and put a check mark next to the listing "Microsoft Scripting Runtime". You also need to create an instance of the object, "Scripting.FileSystemObject" before you can utilize GetFile.
| |