Solved

Run-Time Error 5151

Posted on 2004-03-29
3
4,751 Views
Last Modified: 2009-02-24
I receive a Run-Time error 5151 message when I try out a module in Immediate view.  When I choose the debugger it yellow highlights the line:

Set m_objects=m_objWord.Documents.Add(m_strDIR & m_strTEMPLATE)

Can anyone suggest what's going wrong here?

Thanks,

Andrew
0
Comment
Question by:AndrewMcLaughlin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 10703434
is the document path valid?

i.e. check what it is beforehand

msgbox m_strDIR & m_strTEMPLATE

0
 
LVL 54

Expert Comment

by:nico5038
ID: 10703446
Would help when you post the exact message.
Some thoughts:
1) Do you have a final "\" in the m_strDIR
2) Does the constructed name already exist ?

Nic;o)
0
 
LVL 65

Accepted Solution

by:
rockiroads earned 500 total points
ID: 10703450
by valid I not only meant a valid path but also the document exists
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question