Microsoft
Software
Hardware
Network
Question : Can I browse Documents with VBA without opening them
Is it possible to browse for headings (like Heading1) in documents without opening them? I use Office 97 and VBA.
Answer : Can I browse Documents with VBA without opening them
Here is some code that will look through a folder and return the name of Documents containg the text "Good". I don't know your exact situation, but I'm sure you can tweak it a little.
Dim Fs As Object
Dim i As Integer
Dim strItems As String
Set Fs = Application.FileSearch
With Fs
.NewSearch
.LookIn = "C:\My Documents" 'Path
.FileName = "*.Doc" 'Search through all word document
.SearchSubFolders = True
.TextOrProperty = "Good*" 'Find Word doc(s) contatining this text
If .Execute > 0 Then
If MsgBox("There were " & .foundfiles.Count & " " & "Files found in the " & .LookIn & " Folder" & vbCrLf & _
"Do you want to continue?", vbYesNo + vbQuestion, "Found Files") = vbYes Then
For i = 1 To .foundfiles.Count 'enumerate through found files
strItems = .foundfiles(i) 'put file name in Variable
Debug.Print strItems
'do something to the files
Next
End If
Else:
MsgBox "No Files Found"
End If
End With
Random Solutions
AJAX Refresh in IE?
ImpersonateUser: Failed to impersonate user with 5.
OptiPlex 745 issues
cannot map network drive
Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access them
Microsoft, Terminal Server, Server 2003 Enterprise, Group Policy Folder Redirection
Server Queues: Messages Pending Submission Why is State is "Retry" not "Ready"?
Controlling audio in embedded FLVs
What is best practice for server 2003 rebooting (how often) in a non 24/7 shop to prevent random windows errors?
Can't ATTACH an SQL 2005 DataBase