Skip to main content

Retrieving a paragraph from a word document using VBA [Resolved]

The following code will allow me to insert a paragraph from a word document using VBA (keeping the original formats)

Set WordApp = CreateObject("Word.Application")
WordApp.Visible = True
Set WordDoc = WordApp.Documents.Open(aFile)

WordDoc.Paragraphs(2).Range.Copy
Selection.Paste

WordDoc.Close
WordApp.Quit

However is there any quicker way (that doesn't involve opening an instance of word, and then closing it)


Question Credit: gordon613
Question Reference
Asked June 13, 2016
Tags: , ms-word
Posted Under: Programming
10 views
2 Answers

I don't know the reason you don't want to open the file (maybe someone is using), but you can make a clone of that file and use the clone file. This way you don't open the original file :P


credit: ruirodrigues1971
Answered June 13, 2016
 
As highlighted in the question, the reason why I don't want to open the file in the manner in which I described, is for speed reasons. – gordon613 May 31 at 5:00
 CanDoerz  3 years ago
Your Answer
D:\Adnan\Candoerz\CandoProject\vQA