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

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
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

Forum statistics

Threads
1,223,799
Messages
6,174,669
Members
452,576
Latest member
AlexG_UK

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