Solved

Accessing an existing Word Document

Posted on 2004-10-08
6
335 Views
Last Modified: 2010-04-17
Here is a tough and confusing problem i have, please consider the following code

actDoc = WordApp.Documents.Open(arrStringPath(intFileCount))

actDoc is of type Word.Document
WordApp is of type Word.Application
arrStringPath has the pathname of the word document

When debugging, this message appears as the line of code above is processed

* no user rights (i have sufficient rights)
*document name of path invalid (all path names are stored in the array)

I have used a watch to confirm pathnames are being input into the array

0
Comment
Question by:dev-ngps7
[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
6 Comments
 
LVL 56

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 12258689
Not quite sure what you are trying to do - maybe post more source code. Also more information on the exact error you are getting would help.

I knocked this together very quickly

Dim WordApp As Word.Application
    Dim actDoc As Word.Document
    Dim arrStringPath(3) As String
    Dim i As Integer
   
    arrStringPath(1) = "d:\trash\docs\doc1.doc"
    arrStringPath(2) = "d:\trash\docs\doc2.doc"
    arrStringPath(3) = "d:\trash\docs\doc3.doc"
   
    Set WordApp = CreateObject("Word.Application")
    WordApp.ShowMe
   
    For i = 1 To 3
        Set actDoc = WordApp.Documents.Open(arrStringPath(i))
        actDoc.Close False
    Next
   
    WordApp.Quit False

Seems to work fine. Maybe add the Set command before actDoc = ...
0
 
LVL 3

Expert Comment

by:yellowjetski
ID: 12258720
* no user rights (i have sufficient rights) - If you are running this program in the wwwroot directory, I am sure that the default user is the IIS user which does not have ANY right to open or edit files outside of that directory.

*document name of path invalid (all path names are stored in the array) - This would be related to the problem above or make sure is the absolute path.

Hope that guide you in the right direction.
0
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 12268596
Sounds like you are trying to do this from ASP or ASP.NET or a service. Regardless of which, it sounds like you are trying to refer to a part of the disk drive that the account the program is running under doesn't have access to. You should probably try setting up the account for the service to a known account or give the account access rights to the folder.
0
 

Author Comment

by:dev-ngps7
ID: 12317443
I wish to close this thread due to the fact that i accidently opened up more threads with the same sort of question. For this, i can only  apologise as i am new to Experts Exchange. This problem can be further discussed here:

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21166350.html

Sorry for the inconvenience caused.
0
 
LVL 56

Expert Comment

by:Julian Hansen
ID: 12317532
with reference to this thread and http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21166350.html

Just a point - the questions asked in the two threads are different. In this thread you are asking about solving an error you have been receiving and you received answers to those (that you did not respond to).

In the other thread you are asking something completely different i.e. how to access a Word Document without creating a Word Object - and you received answers to that to - basically you can't.

In neither of the threads have you provided any feedback to the questions posted. If you people to assit you you need to assit them by providing the right information and feedback to posts.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Using VBscript & RegEx, how can I match lines starting with Oracle word 17 93
printf performancy 11 86
backup program with robocopy 6 74
asp Google Map 2 64
A short article about a problem I had getting the GPS LocationListener working.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

726 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