+ Reply to Thread
Results 1 to 6 of 6

Wait on File.readonly

Hybrid View

evertjvr Wait on File.readonly 08-17-2015, 03:09 AM
kadeo Re: Wait on File.readonly 08-17-2015, 03:19 AM
evertjvr Re: Wait on File.readonly 08-17-2015, 03:38 AM
evertjvr Re: Wait on File.readonly 08-17-2015, 03:54 AM
kadeo Re: Wait on File.readonly 08-17-2015, 04:32 AM
berlan Re: Wait on File.readonly 08-17-2015, 04:00 AM
  1. #1
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Wait on File.readonly

    Hi all

    I have a multiple user program and all save to the same workbook(s). Now here is the problem.

    I need a 5 second delay to allow the file to become available before continuing with the operations
    in all my attempts I created an infinity loop that crashes the PC

    During the delayed time I want to display a nice message.

    Thanks

  2. #2
    Forum Contributor
    Join Date
    05-27-2014
    Location
    Belfast, Northern Ireland
    MS-Off Ver
    2007 & 2010
    Posts
    273

    Re: Wait on File.readonly

    This should do what you need it to.

    Application.OnTime
    Please click *Add Reputation if I've helped

  3. #3
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Re: Wait on File.readonly

    Thanks Kadeo the infinity loop is gone but to get it to work will take some work

  4. #4
    Forum Contributor
    Join Date
    02-12-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    275

    Re: Wait on File.readonly

    Kadeo

    If Application.Wait(Now + TimeValue("0:00:" & Seconds)) Then
     
    End If
    served me better but you set me on the right track

    thanks

  5. #5
    Forum Contributor
    Join Date
    05-27-2014
    Location
    Belfast, Northern Ireland
    MS-Off Ver
    2007 & 2010
    Posts
    273

    Re: Wait on File.readonly

    Quote Originally Posted by evertjvr View Post
    Kadeo

    If Application.Wait(Now + TimeValue("0:00:" & Seconds)) Then
     
    End If
    served me better but you set me on the right track

    thanks
    Yeah, The difference between OnTime and Wait is that "Ontime" will execute something at a specific time in the future and other code can still execute during the interim whereas "Wait" will execute something at a specific time in the future but other code will not execute during the interim.

  6. #6
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Wait on File.readonly

    Or use API,
    Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    then in your sub e.g. add (for 1 sec wait, in milliseconds),
    Sleep 1000

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] readonly file
    By cadone in forum Excel General
    Replies: 7
    Last Post: 12-19-2014, 06:46 PM
  2. [SOLVED] Open workbook if not readonly. If readonly try again.
    By Metrazal in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-29-2014, 02:45 PM
  3. VBA Make Closed File ReadOnly (FSO)
    By KRAND in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-28-2011, 08:57 AM
  4. Changing file from readonly
    By Niall in forum Excel General
    Replies: 2
    Last Post: 07-27-2006, 12:05 PM
  5. [SOLVED] Getting readonly & password properties without opening file
    By Eithne R in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-28-2005, 07:05 PM
  6. [SOLVED] How do I use VC++6.0 to protect a excel file to readonly
    By gowinder in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-21-2005, 10:05 PM
  7. [SOLVED] How do I use VC++6.0 to protect a excel file to readonly
    By gowinder in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-21-2005, 10:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1