Solved

Run-Time Error 5151

Posted on 2004-03-29
3
4,690 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now