Solved

Check if a MS-Word file is already opened

Posted on 2003-12-10
7
204 Views
Last Modified: 2010-05-03
I'm automating MS Word from VB6. I want to check if a document is already opened by another instance of Word (on the same or different computer). On my machine each time i open a word doc a hidden file is created:  "~$filename.doc", so i can check for excistence of this file. is this the same for all MS word versions and settings, or is a better procedure available for this check.
0
Comment
Question by:m_wendy
  • 3
  • 2
7 Comments
 
LVL 26

Accepted Solution

by:
EDDYKT earned 250 total points
ID: 9919787
Try this

Open "yourfullpath file.doc" For Binary Access Read Lock Read As #1


Error will occur if file is opened by word
0
 

Author Comment

by:m_wendy
ID: 9963331
Ok this the first step, but i also want to be able to open the file in read-only mode if another user also has the file open in Read-only mode...
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9963616
IF you want to open the word doc, you should use word automation

ie


Wrdapp.Documents.Open FileName:="your odc.doc", ConfirmConversions:=False, _
        ReadOnly:=true

where Wrdapp is word.application

The OS allows only 1 people open for write but no limitiation for people open for read only.
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

Author Comment

by:m_wendy
ID: 9973039
i know that i have to use automation... but i want to check the file before it is opened...
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9973375
Use my first comment
0
 
LVL 27

Expert Comment

by:planocz
ID: 10270435
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
No response from m_wendy from 12/19/2003 comment
Award points to EDDYKT is recommend.
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

planocz
EE Cleanup Volunteer
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

773 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