Hello Peter,
From your post, my understanding on this issue is: 1. How to use
<wordApp>.Windows(docNameVariable).Document in Word 2007, and 2. How to
migrate the COM Addins that were designed for Word 2003, XP, to support
Word 2007. If I'm off base, please feel free to let me know.
For the first question about the use of
<wordApp>.Windows(docNameVariable).Document in Word 2007, based on my test,
this function still runs well on my side. I get the 5941 error only when
the docNameVariable refers to a document that is currently not open. Would
you confirm if docNameVariable is specified correctly on your side? Below
is my detailed test steps:
Step1. Open Word 2007, create a new document "Document1".
Step2. Go to VBA project (Alt+F11), and write the following macro:
Dim oCustomProps As Object
Set oCustomProps =
Application.Windows("Document1").Document.CustomDocumentProperties
For Index = 1 To oCustomProps.Count
oProp = oCustomProps.Item(Index)
MsgBox (oProp.Name & " " & oProp.Type & " " & oProp.Value)
Next
Step3. Run the macro. It does not throw any error.
Step4. Change the document name in the macro from "Document1" to
"Document2" (There is no Document2 opened at the moment).
Step5. Run the macro again, and it throws the error 5941
For you second question about how to migrate the COM addins that were
designed for Word 2003/XP to support Word 2007, I'd suggest the TechNet
article:
Top migration issues in 2007 Office system.
http://technet.microsoft.com/en-us/library/cc179116.aspx
Differences in the 2007 Office system
http://technet.microsoft.com/en-us/library/cc179054.aspx
According to the "Object Model" section in the first article, we indeed
need to test all applications, all lines of code to ensure they are
compatible with the 2007 Office release. I understand this means a lot to
work on your side, but to ensure the compatibility, we have to test the
whole project again. If you encounter any problem during the migration,
feel free to let me know and I do my best to help you.
Regards,
Jialiang Ge (
[email protected], remove 'online.')
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.