Russ
Sat Oct 20 00:29:57 PDT 2007
Helmut and Jonathan,
Apparently Microsoft broke the code for automation for copying between
certain sources and destinations, to avoid spreading macro viruses. They
allow you to manually do what the recorded macro recorded. But then not
allow it to run under automation.
+++++++Quote
This method has one notable limitation: you cannot copy project items from
the Normal template to any other file. This is by design, to prevent the
spread of macro viruses.
In addition, you cannot copy projects to or from a template that is loaded
as an add-in or reference, unless the template is open in Word for editing.
++++++++UnQuote
<
http://support.microsoft.com/kb/211466/EN-US/>
+++++++Quote
Application.OrganizerCopy
Source Target Valid Err Error Message
------------------------------------------------------------------------
Document Document Yes
Document Template Yes
Document Normal Yes
Document Global Temp No* 5940 The project item cannot be copied
Template Document Yes
Template Template Yes
Template Normal Yes
Template Global Temp No* 5940 The project item cannot be copied
Normal Document No 4198 Command failed
Normal Template No 4198 Command failed
Normal Normal No 4198 Command failed
Normal Global Temp No 4198 Command failed
Global Temp Document No 4198 Command failed
Global Temp Template No 4198 Command failed
Global Temp Normal No 4198 Command failed
Global Temp Global Temp No 5940 The project item cannot be copied
NOTE: You can copy from a document or template to a global template if the
global template is open in Word for editing.
++++++++UnQuote
> Hi Jonathan,
>
> very weird, indeed.
>
> I can record a macro without problems.
>
> Sub Macro6()
> Application.OrganizerCopy Source:="C:\Edit2003\Normal.dot",
> Destination:= _
> "C:\Test\Word\organizer.doc", Name:="UserForm1", Object:= _
> wdOrganizerObjectProjectItems
> End Sub
>
> The userform was copied.
> I remove userform1 from organizer.doc.
> I can record the same macro again without problems.
>
> Yet, when trying to run the macro,
> I get "Command failed".
> Doesn't matter whether I try it on the same document,
> having removed userform1,
> or on a new blank document.
--
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID