OrganizerCopy Error Dialog Problem

G

George Lee

When using OrganizerCopy, if the style name is not found in the source
document, Word returns an error dialog. In a VBA application, is there anyway
to suppress this dialog and let the code continue without the user having to
click OK?

The sample code. The dialog after the gSourceWordApp.OrganizerCopy call but
before the If Err.Number = 4198 Then line.

On Error Resume Next
Dim styleName As String
styleName = "corporateNameStyle"
gSourceWordApp.OrganizerCopy Source:=sourceDocument.FindInFileName, _
Destination:=indexWordDocument.FullName, _
Name:=styleName, _
object:=wdOrganizerObjectStyles
If Err.Number = 4198 Then
gSourceWordApp.OrganizerCopy Source:=sourceDocument.FindInFileName, _
Destination:=indexWordDocument.FullName, _
Name:="Normal", _
object:=wdOrganizerObjectStyles
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top