Excel file read only problem

  • Thread starter Thread starter MichaelK
  • Start date Start date
M

MichaelK

When I open excel file from AccessXP it opens in the read only mode.
This file is on another machine in the same network.
I copied file on my local drive and it worked fine in my application.
I checked the properties - it's not read only.
Also I could open in from the same application another file in the same
directory and it worked fine.

Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open(inName)
xlApp.Visible = True

May be there some parameters I have to use to make sure that I can make
changes in the file.

Hope somebody knows what the problem is and how to go around.

Thanks,
Michael
 
Do you have privileges to write to that directory/machine where the EXCEL
file is located?
 
Hi Ken, thanks for your respond.
As I stated in my message, I can open and change this excel file from the
same machine where I'm running access application. It's when I open it
inside of access
I can't do any changes programmatically. Also in debug mode I can see when
excel file opened it has "read only" on the window bar. In addition I was
testing another
file in the same directory and it worked.
But I can't see any difference between files, and it's first time when I see
this.
So I'm trying to find out if there some parameter I can use when open the
file inside of Access to make sure it's updatable. Some kind of
xlApp.ReadOnly = false or something like this.

Thanks,
Michael
 
In the Workbooks.Open method, there is an argument for specifying whether
the file should be opened ReadOnly or not. In EXCEL VBA, the default is
False (don't open the file as ReadOnly). I have found similar behavior when
opening EXCEL from ACCESS via VBA.

Perhaps your arguments in the .Open method line are out of sequence? Post
the code line that you're using to open the EXCEL file.
 
Hi Ken.
This is what I'm doing.
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open(\\xserver\xfiles\filetoupdate.xls)
xlApp.Visible = True
Set xlSheet = xlBook.Worksheets(1)
xlBook.Sheets.Add
Set xlSheet = xlBook.Worksheets(1)
xlSheet.Name = "CurrentData"
xlSheet.Activate

From this point I need to copy some data from another worksheet to
CurrentData sheet. I debug mode I can see how I highlight and copy columns I
need and when
it trying to paste in to new CurrentData sheet nothing happening.
I was looking for some parameter in the .Open method to tell that this
file open for update.
Or maybe I have to set property for newly create worksheet something like:
xlBook.Worksheets(1).ReadOnly = false
This is the only property I found related to this issue.

Just want to remind you that I'm doing it with many files without touching
properties,
this is the first time I ran in to this problem. And not this file is not
readonly.

Regards,
Michael
 
I don't see anything obviously wrong with your code (I'm not an expert on
using UNC syntax, though).

Are you assuming that the file is read only because the copy/paste isn't
working? If yes, you may have syntax errors in the code for doing that
activity.

You may want to post this question in one of the EXCEL newsgroups to see if
they have other suggestions. I've exhausted my list!
 
Ken, I really apreciate your responds.
Just hoped somebody knows how to make sure that file is updatable.

Michael
 
Probably way off base, however:

Is it possible that the Xl file being opened in Access
might already be open in an Xl session somewhere on the
network?

If so, then Xl might be allowing a copy to open as 'read-only'.

Just in inane thought.

Regards.
 
Back
Top