Search closed word document and excel file without opening and check for match

bradyboyy88

Well-known Member
Joined
Feb 25, 2015
Messages
562
Hi,

I am wondering if there is a way to use the find keyword function in a word document and excel file without actually opening it using vba?
 
AHA! It's not declared as a string! It's a variant. I was going to tell you to force it to be a string but that won't work with the for...each statement you have. Instead, let's force the type while it is being put in to a string container so that this can never happen.

Code:
.text=CStr(word)

NOTE: If CSTR fails then it will return null. You might have to handle a null exception later.
 
Last edited:
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hackslash I just ran through 10k files without a single error because you are a debugging genius.
 
Last edited:
Upvote 0
Awww shucks,
Thanks. I hope you learned about error handling in VBA so you can crush bugs in the future! That error handler you have there is super useful. You can use that code all over the place.
 
Upvote 0
Yes this was an awesome learning experience! THanks a lot man I hopefully one day I can return the favor!
 
Upvote 0

Forum statistics

Threads
1,218,193
Messages
6,141,026
Members
450,331
Latest member
Scott JBrown

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top