Armando Vilela Baiões
asked on
add more styles to my code
have this code in one form that searches a certain Style, my question is, is it possible to had more styles in this routine? for example .Style "Scene" and .Style "AnyOtherStyle" I tried the AND operator but it dont work Here is my code so far:
Me.WordDocData.SetFocus
Dim blnFound As Boolean
Set rngSearch = Me.WordDocData.Range
With rngSearch.Find
.ClearFormatting
.Text = ""
.Style = "Scene"
.Forward = True
.Format = True
.Execute
Do While .Found = True
Dim xyz As String
xyz = rngSearch.Text
DoCmd.RunSQL "insert into tblCabecalhos (cabecalho) values ('" & xyz & "');"
Me.frmCabecalhos.Requery
.Execute
Loop
End With
Me.WordDocData.SetFocus
Dim blnFound As Boolean
Set rngSearch = Me.WordDocData.Range
With rngSearch.Find
.ClearFormatting
.Text = ""
.Style = "Scene"
.Forward = True
.Format = True
.Execute
Do While .Found = True
Dim xyz As String
xyz = rngSearch.Text
DoCmd.RunSQL "insert into tblCabecalhos (cabecalho) values ('" & xyz & "');"
Me.frmCabecalhos.Requery
.Execute
Loop
End With
If it was going to work at all, it would be an OR rather than an AND
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.