Hi Everybody,
I have written a bit of code to open an excel file from word and I wish to
work with it a bit (in particular, I wish to set a named range) from there.
When I finish working with it, I want to save the file. However, the manner
in which I open the file opens it as a Read-Only type so that I cannot save
the file with the same name. Here is what I have so far:
Dim excelApplication As Excel.Application
Set excelApplication = CreateObject("Excel.Application")
excelApplication.Visible = True
excelApplication.Application.Workbooks.Open (excelLocation)
excelApplication.Application.Dialogs(xlDialogDefineName).Show
' excelApplication.Application.ActiveWorkbook.Save <-- this is the "bad" part
excelApplication.Application.Quit
For now, assume excelLocation is a reference to a valid string.
Thank you all for your time,
Tim
Russ - 12 Jul 2007 22:59 GMT
Is the file properties read-only checkbox check marked?
If you try to load a file from a CD, it will be read-only by nature. In that
case copy the CD file to the hard drive, open the file's properties, and
uncheck read-only.
> Hi Everybody,
>
[quoted text clipped - 18 lines]
>
> Tim

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID
Tim - 13 Jul 2007 11:54 GMT
The file does not have the read-only checkbox check marked nor is the file
coming from a CD. It is stored in My Documents.
Thanks,
Tim
> Is the file properties read-only checkbox check marked?
> If you try to load a file from a CD, it will be read-only by nature. In that
[quoted text clipped - 23 lines]
> >
> > Tim
Russ - 13 Jul 2007 19:10 GMT
Another thing could be Windows OS putting a lock on a file that is still
open in another application. So you can't save it under the same name while
it is still be used by another application. Could that be what is happening
here?
> The file does not have the read-only checkbox check marked nor is the file
> coming from a CD. It is stored in My Documents.
[quoted text clipped - 31 lines]
>>>
>>> Tim

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID
Tim - 16 Jul 2007 12:20 GMT
Possibly. I tried to come up with a work-around by saving the file with a
different name, then deleting the old one and replacing it with the newly
saved one; however, I seem to not have permission to delete files using the
kill function. Could this be because I am not an administrator on my machine?
Thanks,
Tim
> Another thing could be Windows OS putting a lock on a file that is still
> open in another application. So you can't save it under the same name while
[quoted text clipped - 36 lines]
> >>>
> >>> Tim
Russ - 16 Jul 2007 17:49 GMT
Definitely. Especially if you weren't the original creator of the file and
you are working on a machine with security policies set up.
> Possibly. I tried to come up with a work-around by saving the file with a
> different name, then deleting the old one and replacing it with the newly
[quoted text clipped - 49 lines]
>>>>>
>>>>> Tim

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID