ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving a file (https://www.excelbanter.com/excel-programming/323146-saving-file.html)

Alastair MacFarlane

Saving a file
 
Dear All,

Programtically a Workbook is opened as read only from a
shared directory. How can I enure that when a user tries
to press save, the directory where the file was opened is
not the directory that Excel tries to save the file, but
one of my choice?

Chdir does not work. I could customise the Excel Workbook
or make the shared directory read only, but is there an
easier way?

Alastair


Rob Bovey

Saving a file
 
"Alastair MacFarlane" wrote in message
...
Programtically a Workbook is opened as read only from a
shared directory. How can I enure that when a user tries
to press save, the directory where the file was opened is
not the directory that Excel tries to save the file, but
one of my choice?

Chdir does not work. I could customise the Excel Workbook
or make the shared directory read only, but is there an
easier way?


Hi Alastair,

Modifying the workbook or making the directory read-only are your only
options. Can you explain exactly what you mean by "ChDir does not work." If
you are trying to change the current directory to a different drive then you
must use ChDrive first to change the drive before using ChDir to change the
directory. I think the best place to put the code required to change the
current directory before the workbook is saved would be the
Workbook_BeforeClose event procedure.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm



Alastair[_4_]

Saving a file
 
Rob,

Thanks for your quick reply. Your comments were much as I
had expected, although I didn't know that ChDrive had to
proceed Chdir to achieve the results I wanted to achieve.
I think my best option is to change the code of the save
toolbar and File, Save/Save As to change the drive and
diectory.

Once again thanks again...

Alastair

-----Original Message-----
"Alastair MacFarlane"

wrote in message
...
Programtically a Workbook is opened as read only from a
shared directory. How can I enure that when a user tries
to press save, the directory where the file was opened

is
not the directory that Excel tries to save the file, but
one of my choice?

Chdir does not work. I could customise the Excel

Workbook
or make the shared directory read only, but is there an
easier way?


Hi Alastair,

Modifying the workbook or making the directory read-

only are your only
options. Can you explain exactly what you mean by "ChDir

does not work." If
you are trying to change the current directory to a

different drive then you
must use ChDrive first to change the drive before using

ChDir to change the
directory. I think the best place to put the code

required to change the
current directory before the workbook is saved would be

the
Workbook_BeforeClose event procedure.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm


.



All times are GMT +1. The time now is 08:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com