J
Jigar Shah
Hi,
I have created a below function for finding all the occuracne of
"Requirements" in the given range. I am not able to execute it properly.
Can any one suggest me what is the problem ?
Public Function FindInLoopAndFormat(ByVal objRange As Range) As Integer
'Dim oWord As ApplicationClass
'Dim oWD As Document
'Dim Start As Integer
'Dim [End] As Integer
'Dim objFindRange As Object
'Dim objRange As Object
'Dim objFind As Microsoft.Office.Interop.Word.Find
Dim intFound As Integer
Try
'oWord = New ApplicationClass
'oWD = oWord.Documents.Open(Path)
'Dim intFound As Integer
Dim rngResult As Microsoft.Office.Interop.Word.Range
MessageBox.Show("Search Text = " & objRange.Text)
Dim fnd As Microsoft.Office.Interop.Word.Find
Do
'Reseting Range After Finding The Word.
rngResult = objRange.Duplicate
fnd = rngResult.Find
' Find all instances of the word "lorem" and bold each.
fnd.ClearFormatting()
fnd.Forward = True
fnd.MatchWholeWord = True
fnd.MatchSoundsLike = False
fnd.MatchCase = False
fnd.Format = False
fnd.Wrap = WdFindWrap.wdFindStop
fnd.Text = "Requirements"
fnd.Execute()
If Not fnd.Found Then
Exit Do
End If
rngResult.Select()
Debug.WriteLine(fnd.Parent.start)
Debug.WriteLine(fnd.Parent.end)
intFound += 1
Loop Until Not fnd.Found
MessageBox.Show( _
String.Format(fnd.Text & " found {0} times.", intFound), _
"FindInLoopAndFormat")
Catch ex As Exception
End Try
End Function
Another think I want is how to make chm from the word document.
any body knows about any free tool or souce available.
Thanks in Advance
From
Jigar Shah
I have created a below function for finding all the occuracne of
"Requirements" in the given range. I am not able to execute it properly.
Can any one suggest me what is the problem ?
Public Function FindInLoopAndFormat(ByVal objRange As Range) As Integer
'Dim oWord As ApplicationClass
'Dim oWD As Document
'Dim Start As Integer
'Dim [End] As Integer
'Dim objFindRange As Object
'Dim objRange As Object
'Dim objFind As Microsoft.Office.Interop.Word.Find
Dim intFound As Integer
Try
'oWord = New ApplicationClass
'oWD = oWord.Documents.Open(Path)
'Dim intFound As Integer
Dim rngResult As Microsoft.Office.Interop.Word.Range
MessageBox.Show("Search Text = " & objRange.Text)
Dim fnd As Microsoft.Office.Interop.Word.Find
Do
'Reseting Range After Finding The Word.
rngResult = objRange.Duplicate
fnd = rngResult.Find
' Find all instances of the word "lorem" and bold each.
fnd.ClearFormatting()
fnd.Forward = True
fnd.MatchWholeWord = True
fnd.MatchSoundsLike = False
fnd.MatchCase = False
fnd.Format = False
fnd.Wrap = WdFindWrap.wdFindStop
fnd.Text = "Requirements"
fnd.Execute()
If Not fnd.Found Then
Exit Do
End If
rngResult.Select()
Debug.WriteLine(fnd.Parent.start)
Debug.WriteLine(fnd.Parent.end)
intFound += 1
Loop Until Not fnd.Found
MessageBox.Show( _
String.Format(fnd.Text & " found {0} times.", intFound), _
"FindInLoopAndFormat")
Catch ex As Exception
End Try
End Function
Another think I want is how to make chm from the word document.
any body knows about any free tool or souce available.
Thanks in Advance
From
Jigar Shah