For every question, there's an answer -- and you'll find it here!


Printer-friendly copy
Top The PC Q&A Forum The Computer Forum topic #385547
View in linear mode

Subject: "VBA GetFile in MS Word" Previous topic | Next topic
_Chewy_Tue Oct-25-05 02:05 AM
Member since Dec 07th 2002
5255 posts
Click to send email to this author Click to send private message to this authorClick to view this author's profileClick to add this author to your buddy list
"VBA GetFile in MS Word"
Tue Oct-25-05 02:06 AM by _Chewy_

  

          

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?

  

Alert Printer-friendly copy | | Top

Replies to this topic

SteveYandlTue Oct-25-05 01:23 PM
Charter member
6481 posts
Click to send email to this author Click to send private message to this authorClick to view this author's profileClick to add this author to your buddy list
#1. "RE: VBA GetFile in MS Word"
In response to _Chewy_ (Reply # 0)
Tue Oct-25-05 01:25 PM by SteveYandl

          

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.

  

Alert Printer-friendly copy | | Top

Top The PC Q&A Forum The Computer Forum topic #385547 Previous topic | Next topic
Powered by DCForum+ Version 1.27
Copyright 1997-2003 DCScripts.com
Home
Links
About PCQandA
Link To Us
Support PCQandA
Privacy Policy
In Memoriam
Acceptable Use Policy

Have a question or problem regarding this forum? Check here for the answer.