Solved

Run-Time Error 5151

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

895 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

20 Experts available now in Live!

Get 1:1 Help Now