Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Open As Readonly

I'm trying to get my macro to open a file as Readonly, but
all I can do is get it to open a file. When I look at the
code that is created for opening, opening as readonly and
opening as copy, it all looks exactly the same.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Open As Readonly

I should add to this that I am actually importing a TXT
file, so the code uses Workbooks.OpenText, not
Workbooks.Open

I see that if I use WorkBooks.Open, I can use
ReadOnly:=True, however this doesn't work for
Workbooks.OpenText

-----Original Message-----
I'm trying to get my macro to open a file as Readonly,

but
all I can do is get it to open a file. When I look at

the
code that is created for opening, opening as readonly and
opening as copy, it all looks exactly the same.


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Open As Readonly

usually
workbooks.open "filename/path", true/false (for read only), true ' true
for read only works for me.


Keith
www.kjtfs.com


---
Message posted from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Open As Readonly

Ths code will do what you want, just replace the full file
name in the quotes. If you look at the VBA help for the
Open method, you'll see that you can add qualifiers to the
basic command to do pretty much anything you might want to
when opening a file.

workbooks.Open filename:="C:\amendments.xls",readonly:=true

Cheers, Pete

-----Original Message-----
I'm trying to get my macro to open a file as Readonly,

but
all I can do is get it to open a file. When I look at

the
code that is created for opening, opening as readonly and
opening as copy, it all looks exactly the same.


.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Open As Readonly

Unfortunately, my followup message didn't get posted fast
enough, explaining that I'm importing a file, and
therefore using Workbooks.OpenText and not
Workbooks.Open.

Thanks to both of you, however, for your suggestions.


-----Original Message-----
usually
workbooks.open "filename/path", true/false (for read

only), true ' true
for read only works for me.


Keith
www.kjtfs.com


---
Message posted from http://www.ExcelForum.com/

.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Open As Readonly

I think you'll find that you have opened it readonly
because a text file opened by Excel can still be opened
using NotePad (for instance).
I think this is the case because the text is "loaded" into
an empty workbook.

If you were to open the file using the VBA code, then
Open "fileName.txt" For Input Access Read Shared As #1

Kevin Beckham

-----Original Message-----
I should add to this that I am actually importing a TXT
file, so the code uses Workbooks.OpenText, not
Workbooks.Open

I see that if I use WorkBooks.Open, I can use
ReadOnly:=True, however this doesn't work for
Workbooks.OpenText

-----Original Message-----
I'm trying to get my macro to open a file as Readonly,

but
all I can do is get it to open a file. When I look at

the
code that is created for opening, opening as readonly

and
opening as copy, it all looks exactly the same.


.

.

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
Changing file from readonly Niall Excel Discussion (Misc queries) 2 July 27th 06 04:58 PM
How do I use VC++6.0 to protect a excel file to readonly gowinder Excel Worksheet Functions 1 September 22nd 05 02:16 AM
Readonly files nc Excel Discussion (Misc queries) 2 March 18th 05 11:13 AM
Closing ReadOnly file using VBA acces Excel Programming 1 January 15th 04 08:59 PM
Change ReadOnly State Jos Vens Excel Programming 2 November 17th 03 10:35 PM


All times are GMT +1. The time now is 01:49 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"