FaheemAhmadGul
asked on
Macro that will open a Word Document based on the first two words of the paragraph in which the cursor currently is
I need help writing a macro that will open a pre-existing word document for me and make that newly opened document active document. The name of the file to be opened will be based on the first two words of the paragraph in which the cursor currently is plus the word medication.
So if the cursor is currently in the following paragraph:
Medical History
This is just a test paragraph to check if this macro
will open a new document for me based on the first two words of this paragraph which are Medical History in this case plus the word Medication.
In the above case macro will open a document with the following path and name (C:\Test\Faheem Ahmad Medication).
Thanks for your help in anticipation.
So if the cursor is currently in the following paragraph:
Medical History
This is just a test paragraph to check if this macro
will open a new document for me based on the first two words of this paragraph which are Medical History in this case plus the word Medication.
In the above case macro will open a document with the following path and name (C:\Test\Faheem Ahmad Medication).
Thanks for your help in anticipation.
ASKER
Many thanks for the prompt response to request for help. This works but requires a slight modification. The code above opens a document based on the first the two word the para where the cursor currently is. But I would like the name of file to be opened to be equal to the first two words of the para plus the word "Medication".
So if the first two words of the current para are "Medical History" I would like the path and the name of the file to be opened to be (C:\Test\ Medical History Medication).
So if the first two words of the current para are "Medical History" I would like the path and the name of the file to be opened to be (C:\Test\ Medical History Medication).
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent. This is working fine now. Many thanks. Regards. Faheem
ASKER
Excellent. This is working fine now. Many thanks
Open in new window