D
Dave
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
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