I'm trying to copy a macro from the active document to a document
which has just been created. The macro is not in the Normal.dot
template, just in the active document. The code looks like:

Dim DocA As Document, DocB As Document
Set DocA = ActiveDocument
' Create new document
Set DocB = Word.Documents.Add(DocA.AttachedTemplate.Name)
'Copy macro to new doc
Application.OrganizerCopy Source:=DocA, _
Destination:=DocB, _
Name:="CreateCustom", _
Object:=wdOrganizerObjectProjectItems

I'm having two problems: first, I get a "Run-time error '4149': File
not found" error unless the current folder for Word is the the folder
with the two documents. Second, when the current folder is set to the
folder with the two documents, I get "Run-time error: '5940': The
project item cannot be copied.

The examples I've found for this have a .dot file for the source, but
I don't know what to do in this instance.

thanks in advance, dave

Re: OrganizerCopy Problem by Dave

Dave
Wed May 07 05:35:22 PDT 2008

On May 4, 5:40=A0pm, Dave <D...@helvetiawv.com> wrote:
> I'm trying to copy a macro from the active document to a document
> which has just been created. The macro is not in the Normal.dot
> template, just in the active document. The code looks like:
>
> Dim DocA As Document, DocB As Document
> Set DocA =3D ActiveDocument
> ' Create new document
> Set DocB =3D Word.Documents.Add(DocA.AttachedTemplate.Name)
> 'Copy macro to new doc
> Application.OrganizerCopy Source:=3DDocA, _
> =A0 Destination:=3DDocB, _
> =A0 Name:=3D"CreateCustom", _
> =A0 Object:=3DwdOrganizerObjectProjectItems
>
> I'm having two problems: first, I get a "Run-time error '4149': File
> not found" error unless the current folder for Word is the the folder
> with the two documents. Second, when the current folder is set to the
> folder with the two documents, I get "Run-time error: '5940': The
> project item cannot be copied.
>
> The examples I've found for this have a .dot file for the source, but
> I don't know what to do in this instance.
>
> thanks in advance, dave

I solved part of the problem. Changing the Source to
Source:=3DActiveDocument.FullName
got rid of the "File not found" error. If anyone has thoughts on why
the macro won't copy, I will appreciate them.

thanks,

dave