Results 1 to 6 of 6

Thread: VBA XL 2010: Path / File access error ??
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular monirg's Avatar
    Join Date
    Jan 2005
    Location
    Ottawa, Canada
    Posts
    629
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation VBA XL 2010: Path / File access error ??

    Hello;

    1) Here’s another example of XL 2003 w/b code not working properly in XL 2010, but it appears specific enough in this case!
    The w/b Open() event code had been copied a while back from an XL ref, and the w/b works perfectly in XL 2003.
    (I’ve just opened and run the w/b in XL 2003 with no problem!)

    2) When the XL 2003 w/b is opened in XL 2010, I get the error:
    Run-time error ‘75’:
    Path / File access error
    and the Open statement in the following code is highlighted.

    3) Top section of the code:
    Code:
    Private Sub Workbook_Open()
    Dim StartTime#, CurrentTime#
     
      Const TrialPeriod# = 30 
     
    'set own obscure path and file-name
      Const ObscurePath$ = "C:\"
      Const ObscureFile$ = "TestFileLog.Log"
     
    If Dir(ObscurePath & ObscureFile) = Empty Then
       StartTime = Format(Now, "#0.#########0")
       Open ObscurePath & ObscureFile For Output As #1
    Your help would be greatly appreciated.

    Regards.
    Monir
    (XL , 64-bit, Windows 10 Enterprise)

  2. #2
    MrExcel MVP
    Moderator
    xenou's Avatar
    Join Date
    Mar 2007
    Location
    Clev. OH, USA
    Posts
    16,464
    Post Thanks / Like
    Mentioned
    11 Post(s)
    Tagged
    1 Thread(s)

    Default Re: VBA XL 2010: Path / File access error ??

    Just a guess but if your system has changed (which is why you have 2010 now) the file permissions for access to the root drive may have changed. It's not uncommon for C: to be reserved to administrative users. Maybe test with a log file in another location?

    Using: Office 2010/Win7 (work) Office 2010/Win7 (home)

    You are rich in proportion to the number of things you can let alone.
    -- Henry David Thoreau

  3. #3
    Board Regular monirg's Avatar
    Join Date
    Jan 2005
    Location
    Ottawa, Canada
    Posts
    629
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA XL 2010: Path / File access error ??

    Hi xenou;
    Thank you for your reply and good to hear from you!

    1) I forgot to mention in the OP that it’s a local computer (no Network), runing Office 2010 (only), and I’m the only User/Computer Administrator.
    Under the User Accounts on the (new) 2010 m/c, it displays only one a/c, which is the correct a/c:
    Monir
    Administrator
    Password protected
    Exactly as I have it on the XL 2003 computer!

    2) So basically, everything should be accessible to me once I log on. Furthermore, I’ve installed, changed, created new folders & files, etc., in the the root directory C:\ of the 2010 m/c with no problems. Mind you, manually and not via XL 2010 VBA code as described in the OP.

    Regards.
    Monir
    (XL , 64-bit, Windows 10 Enterprise)

  4. #4
    MrExcel MVP
    Moderator
    xenou's Avatar
    Join Date
    Mar 2007
    Location
    Clev. OH, USA
    Posts
    16,464
    Post Thanks / Like
    Mentioned
    11 Post(s)
    Tagged
    1 Thread(s)

    Default Re: VBA XL 2010: Path / File access error ??

    Please try the suggestion and then we can continue if it doesn't work.
    ξ

    Using: Office 2010/Win7 (work) Office 2010/Win7 (home)

    You are rich in proportion to the number of things you can let alone.
    -- Henry David Thoreau

  5. #5
    Board Regular monirg's Avatar
    Join Date
    Jan 2005
    Location
    Ottawa, Canada
    Posts
    629
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA XL 2010: Path / File access error ??

    Hi xenou;
    Maybe test with a log file in another location?
    I have just had the opportunity to try your suggestion.
    It works fine. Thank you!

    Any location on the new laptop except the root directory C:\ appears to be working fine.
    So for now, Iíve opted for the w/b folder as the destination of the log file, even though my preference remains C:\.

    Regards.
    Monir
    (XL , 64-bit, Windows 10 Enterprise)

  6. #6
    MrExcel MVP
    Moderator
    xenou's Avatar
    Join Date
    Mar 2007
    Location
    Clev. OH, USA
    Posts
    16,464
    Post Thanks / Like
    Mentioned
    11 Post(s)
    Tagged
    1 Thread(s)

    Default Re: VBA XL 2010: Path / File access error ??

    Okay. I can't really explain why you can create files on C: otherwise, but not in code. It must be a security protocol related to protection against malicious scripts - I've been in a few situations where I couldn't write to the C: drive so I just avoid it anymore.

    ξ

    Using: Office 2010/Win7 (work) Office 2010/Win7 (home)

    You are rich in proportion to the number of things you can let alone.
    -- Henry David Thoreau

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •