Word Application.OrganizerCopy Runtime Error 4149

J

Julian Ladbury

Word 2007 and Word 2010 give Runtime Error 4149 when executing the
Application.OrganizerCopy command to copy styles into a newly created
document when the document containing the macro resides on a network drive.
If the document is on the local machine (e.g. the user's desktop), no error
occurs. Word 2003 and earlier work fine even if the document is on a network
drive.

The document at
http://cid-75e3e350f569b887.skydrive.live.com/self.aspx/.Public/Bug 38/Bug38^_Reproduce for MSDN.doc can be used to recreate the problem.
 
T

Tony Jollans

Hi Julian,

I can't recreate this - can you be a bit more specific?

I put a document with this macro on a network drive and it worked:

Dim ndoc As Document
Set ndoc = Documents.Add

Application.OrganizerCopy _
Source:="C:\Users\Tony\Desktop\WTony1.doc", _
Destination:=ndoc.Name, Name:="Tony1", _
Object:=wdOrganizerObjectStyles
 
T

Tony Jollans

Let me start again ...

I do get the error in Word 2010 with your document. My first tests were done
on Word 2007 SP1, so I need to check more thoroughly.
 
C

Colbert Zhou [MSFT]

Hello Julian,

Thanks for posting and reporting the issue.

Yes, i can reproduce the issue. And currently, the workaround would be
always saving the target new document firstly before we call OrganizerCopy in
codes.

So the Test function changes to,

Sub test()
Dim d As Document
Set d = Documents.Add
d.SaveAs (d.FullName)
Call BWordCopyDocumentStyles(ThisDocument, d)
End Sub

This will make sure the document is available to Word application event it
is run from network environment.

Does the workaround work for you?

Best regards,
Ji Zhou
Microsoft Online Community Support
 
J

Julian Ladbury

Yes Colbert, the workaround does the trick for me.

Presumably you will be reporting this as a bug?
 
Joined
Jul 6, 2022
Messages
1
Reaction score
0
Hello Julian,

Thanks for posting and reporting the issue.

Yes, i can reproduce the issue. And currently, the workaround would be
always saving the target new document firstly before we call OrganizerCopy in
codes.

So the Test function changes to,

Sub test()
Dim d As Document
Set d = Documents.Add
d.SaveAs (d.FullName)
Call BWordCopyDocumentStyles(ThisDocument, d)
End Sub

This will make sure the document is available to Word application event it
is run from network environment.

Does the workaround work for you?

Best regards,
Ji Zhou
Microsoft Online Community Support



*********
can you tell me where to do this in my macro?

Sub ja1()
'
' ja1 Macro
'
'
With ActiveWindow.View.RevisionsFilter
.Markup = wdRevisionsMarkupNone
.View = wdRevisionsViewFinal
End With
With ActiveDocument
.UpdateStylesOnOpen = False
.AttachedTemplate = "Normal"
End With
Application.OrganizerCopy Source:= _
"D:\Desktop\26 0500 - Common Work Results for Electrical.docx", _
Destination:= _
"C:\Users\emilee.gevock\AppData\Local\Microsoft\Windows\INetCache\Content.MSO\E088FB1A.docx" _
, Name:="_COMMENT", Object:=wdOrganizerObjectStyles
 

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