Vbanewbie101
Instructor
The following code works in VB but not in VBA. A word document is opened the code looks for a string of text. If it finds it, it checks to see if the style is Heading 2. VBA gives me an overload error. Thanks
Dim mheading2
mheading2 = 0
'
Set myRange = ActiveDocument.Content
'
With Myrange.find
.clearformatting
.text="Computer Literacy requirement"
.Forward=True
.Execute
End With
'
If myrange.Find.Found Then
If myrange.Style = "Heading 2" Then
mHeading2 = 3
Else
mHeading2 = 0
End If
Else
mheading2=0
End If
Dim mheading2
mheading2 = 0
'
Set myRange = ActiveDocument.Content
'
With Myrange.find
.clearformatting
.text="Computer Literacy requirement"
.Forward=True
.Execute
End With
'
If myrange.Find.Found Then
If myrange.Style = "Heading 2" Then
mHeading2 = 3
Else
mHeading2 = 0
End If
Else
mheading2=0
End If