Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6669755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:11:16+00:00 2026-05-26T03:11:16+00:00

I have an Access application that’s currently using the fhandlefile() procedure here: http://access.mvps.org/access/api/api0018.htm …to

  • 0

I have an Access application that’s currently using the fhandlefile() procedure here:
http://access.mvps.org/access/api/api0018.htm
…to open arbitrary files.

I’d like to be able wrap that routine in my own procedure like OpenFile(strFilePath, bolReadOnly) so that I can open files as read-only as needed. However, I don’t see anywhere in that Shell API call where I could do that. Two alternative solutions I’ve already thought of (but have issues) are:

  1. Change the file attributes just before opening the file to be read-only, then change them back right after opening it. This is a weird solution though because the user has to have sufficient privileges in order to do this, which usually contradicts the whole “opening file as read-only” thing.
  2. Use file-type-dependent APIs to open certain types of files (Word documents for example) as read-only. This is a problem because I don’t want to have to case out all different file types, and I want to stay away from extra libraries as much as possible.

Anyone have any ideas on how I can tweak my existing routine or substitute it with something else that would allow this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:11:16+00:00Added an answer on May 26, 2026 at 3:11 am

    Looking at the API you’re calling it…

    1. Tries to open the using a call to ShellExecte to open the file with using the default verb is used, if available. If not, the “open” verb is used.

    2. If that fails it tries to open the file using the Open With… dialog see How To Invoke the “Open With…” Dialog Box Using _shellexecute

    Both these methods use the information associated with the file to open the correct application, but there’s no way to pass “Read-only”. My guess is that this is because not every file type has a readonly or even an writeable context.

    You could as an alternative open the file in a Web Browser.

    For example (using a reference to “Microsoft Internet Controls” Typically found at c:\windows\system32\ieframe.dll)

    Dim ie As InternetExplorer
    set ie = New InternetExplorer
    
    ie.Navigate "file://yourFile"
    ie.Visible = True
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have an MS Access application that connects to a PostgreSQL database via
I have inherited a VB6/Access application that we have developed and sold for many
My application requires that I have access to the file system. Regardless if the
I have built a MS Access 2007 application that can create reports files in
I have to support an application that uses an access database. My development machine
I have a web application that will need to access code behind methods as
I have an C# form application that use an access database. This application works
Scenario: I have a console application that needs to access a network share with
I have a .Net 4.0 WPF application that requires an embedded database. MS Access
I have an application in Access 2003 that I am working on. In it,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.