ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   trying to search 4 text in a word doc & print page? (https://www.excelbanter.com/excel-programming/293929-trying-search-4-text-word-doc-print-page.html)

rede96

trying to search 4 text in a word doc & print page?
 
I am using VBA to open a word document from Excel, which is no problem
(Using the CreateObject method, Dim wrdApp As Word.Application, Di
wrdDoc As Word.Document etc.)

I would then like to search for a given string in the word document an
then print the current page.

Also, (But it's not that important.) I would then like to close th
word doc and rename it so I know the file has been processed.

Can anyone help me with the VBA code I should use to do this please?

TIA

Re

--
Message posted from http://www.ExcelForum.com


AA2e72E[_2_]

trying to search 4 text in a word doc & print page?
 
Open a document in Word, switch the macro recorder on and then search for something, File | Print + select current selection and then switch off macro recorder

The bulk of the code is now available in the VBE (Alt + F11). To make the code work from within Excel, prefix the Word objects with the name of the object that you are using (withing Excel) as an instance of Word.


All times are GMT +1. The time now is 08:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com