appWord.OrganizerCopy error in word 2007

P

Princess Fiona

Hi,
I am trying to create a template for a document. I would like to copy the
styles from the document to the template. In Word 2002 the following VBA-Code
works fine:
-----------------------------------------------------------------------------------------------
sSource = m_docSource.FullName
Set docTemplate = appWord.Documents.Open( _
m_docSource.AttachedTemplate.FullName, _
addtorecentfiles:=False, _
Visible:=False)
'Un-protect the template if protected (will not be protected when saved again)
If docTemplate.ProtectionType <> wdNoProtection Then
docTemplate.Unprotect m_sPasswordForOpen
End If
sTarget = docTemplate.FullName

For Each stlSource In m_docSource.Styles
If stlSource.InUse Then
appWord.OrganizerCopy sSource, sTarget, stlSource.NameLocal,
wdOrganizerObjectStyles
End If
Next
-----------------------------------------------------------------------------------------------

In Word 2007 this code works fine also, but only if the ActiveDocument is
stored on the local filesystem.
If the source document is stored somewhere on a fileserver the code produces
a error on appWord.OrganizerCopy that tells you, that the sSource document
is already open.
The system seems to block itself.
I have also used a mapped drive to the file server but this did not work
either.
Does anybody know a solution, how to solve the problem?

Thanks for help.
 

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