Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default is file available for editing ?

Is there a way to check if file is available for editing ?
--
Thanks & Best Regards
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default is file available for editing ?

here is one way

Dim x As String
x = Excel.Workbooks("book1").ReadOnly = True
If x = "True" Then
MsgBox "File is Read Only"
Else
MsgBox "File is available for editing"
End If

"LeeL" wrote:

Is there a way to check if file is available for editing ?
--
Thanks & Best Regards

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default is file available for editing ?

Thanks, just one quick question, how to form the x stament for a text file ?
For example "H:\log.txt"


"dmoney" wrote:

here is one way

Dim x As String
x = Excel.Workbooks("book1").ReadOnly = True
If x = "True" Then
MsgBox "File is Read Only"
Else
MsgBox "File is available for editing"
End If

"LeeL" wrote:

Is there a way to check if file is available for editing ?
--
Thanks & Best Regards

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default is file available for editing ?

The code assumes that the text file was opened through excel.

"LeeL" wrote:

Is there a way to check if file is available for editing ?
--
Thanks & Best Regards

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default is file available for editing ?

this may better suit your needs - adjust the path and filename either
manually of with a variable and the code will tell u if the file is avialable
for editing and the file type does not matter


Sub tst()
Dim myfilename As String
myfilename = "C:\Documents and Settings\1006646\Desktop\26022h.txt"

x = GetAttr(myfilename) And vbReadOnly
If x = 1 Then
MsgBox "file is read only'"
Else: MsgBox "file is avialable for edit"
End If

End Sub


"LeeL" wrote:

Thanks, just one quick question, how to form the x stament for a text file ?
For example "H:\log.txt"


"dmoney" wrote:

here is one way

Dim x As String
x = Excel.Workbooks("book1").ReadOnly = True
If x = "True" Then
MsgBox "File is Read Only"
Else
MsgBox "File is available for editing"
End If

"LeeL" wrote:

Is there a way to check if file is available for editing ?
--
Thanks & Best Regards

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
downloading excel file for open causes "file is locked for editing HigherImpact Excel Programming 0 December 3rd 07 06:23 PM
Trying to Open Excel File, But its says file is locked for editing Smeeta Geary Excel Discussion (Misc queries) 1 September 20th 05 01:28 PM
Copying the Editing in one file to Another opened XLS file Ahmad Excel Worksheet Functions 1 May 27th 05 02:04 PM
Copying the Editing in one file to Another opened XLS file Ahmad[_3_] Excel Programming 1 May 27th 05 02:04 PM
file now available for editing Sam Excel Programming 1 February 25th 05 12:07 PM


All times are GMT +1. The time now is 09:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"