Results 1 to 4 of 4
  1. #1
    mp3909 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    154

    How to open a workbook in NON-READ mode

    Using Microsoft Access VBA, I am trying to open up an excel workbook in Non-Read mode but it keeps opening up in read-only mode.



    This is my code:

    Code:
    Sub ExportToExistingFile(file As String, queryName As String)    Dim xlApp As Object
        Set xlApp = CreateObject("Excel.Application")
        
        xlApp.Visible = True
        
        Dim xlWbk As Object
        Set xlWbk = xlApp.workbooks.Open(file, False, False)
        
        Dim rs As DAO.Recordset
        Set rs = CurrentDb.OpenRecordset(queryName)
        
        xlWbk.Worksheets.Add(After:=xlWbk.Worksheets(xlWbk.Worksheets.Count)).Name = "sdada"
        xlWbk.Worksheets(2).Range("A1").copyfromrecordset rs
        
        xlWbk.Close True
        xlApp.Quit
    End Sub

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    There no point of opening a workbook if you cannot read it.
    what do you mean NON READ?

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Shot in the dark, but is the file in a read-only folder?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    Or maybe the file itself is read only. If you copy from CD/DVD it inherits read only attribute when copied to pc disk.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 12-01-2014, 07:47 AM
  2. Replies: 2
    Last Post: 09-04-2013, 11:01 PM
  3. Replies: 1
    Last Post: 08-08-2013, 03:54 PM
  4. Open Access Database in Read Only Mode
    By praloy in forum Programming
    Replies: 2
    Last Post: 03-28-2012, 10:50 PM
  5. Replies: 2
    Last Post: 09-01-2011, 10:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums