View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default how to make sure the file is saved on a network

I'm not sure if it's a file contention issue that's causing your problem.

The same kind of thing can happen with a single user working on a file.

When you save a file, excel will save it as a temporary file (8 characters, no
extension). Then if that save is successful, excel will delete the original and
rename this funny named file to the original's name.

You see the results when something interferes with this process.

A couple of things that get pointed at are antivirus software and network
problems (hardware or permissions).

Maybe you could disable the antivirus software (temporarily) to see if that
helped.

If it's not the antivirus software, did something on your network change
recently?

(if the problem went away by disabling the AV software, maybe a visit to its
site to see if there are any upgrades available???)

===
And I would have guessed that as soon as one person got exclusive control of the
workbook, no other user could do much to interfere with that (but that's a
guess).



kedarkulkarni wrote:

Hi,
I have created an excel addin which adds a toolbar after help menu bar.
It opens querydatabase.xls in the same directory where addin exists in
readonly mode and allows you to add, edit, save records.
The file is not shared and saved with a open and readonly password
every time it saves. due to the password nobody opens the file in their
excel window and the addin is used by 15+ staff at a time.
whenever a user wants to add a record or edit record he is given a
userform to add record/ edit record. (the file is opened in the
background in readonly mode and window is hidden to retrieve the
original record to edit the record)

when the usr presses save, the file is opened in exclusive mode and
changes are saved by going to correct row by seeking the correct record
in edit by match function on primary key and if new record then the
last row by xlup

the problem is if 2 staff press save at the same time then excel
sometimes create a file with hex name like A00H080 without extension
(doesnt goto err handler if fails to save with exact name). i dont know
why this happens and how can i make sure that the record is saved or
not.

the line for opening in the background is as follows
workbooks(querydb).open querydbfullpath ,,:true (readonly),readPWD

when saving
workbooks.open querydbfullpath ,,opnPWD,readPWD
if workbooks(querydb).readonly)
msgbox "file is locked by somebody cant save now try after 10
seconds" : exitsub........
endif
change or add a record
workbooks(querydb).saveas workbooks(querydb).fullpath
,,opnPWD,readPWD,exclusive... etc.
workbooks.open querydbfullpath, readonly

but it doesnt return any err msg if the file is not saved. (document
not saved)

I have made sure that the file opened is not in readonly mode after it
is opened with workbooks(querydb).readonly flag.
So if a file is opened in exclusive mode and there is plenty of place
on server and saved immediately why the record isn't saved sometime?

it was working intially ok when file size was below 400k but now gives
a bit problem.

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


--

Dave Peterson