Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Original Excel File gets deleted and temp file gets created.

Guys,

I have a major problem with an Excel workbook that i created and have
been try to resolve this issue for a couple of weeks and my Bosses are
breathing down my neck.

Here is how it works:
I have multiple users using the excel workbook at the same time (they
will open as read only). Once they are done with the data entry they
run a macro. Which will copy data from this excel workbook opens
another file, which is saved in the Shared Drive (Network Drive) and
pastes it as the last entry made in that workbook. If another user is
using this file then it throws an error boxing saying that, "The file
is locked by another user for editing and try after 10 seconds". Then
saves the workbook that it opened from the shared drive and closes it.

The problem is that the macro is running ok till the point of opening
the file making the entry but then when it tried to save the file it
creates a temp file in the same location instead and deletes the
original file. So when other users run the macro again the file does
not get located and they get Run Time error 1004.

This problem is only happening 5 to 10% of the times and usually occurs
when multiple users are trying to save the file at the same time.

I did read the previous threads, the suggestions i got from there we
It could be an Anti Virus issue. Norton is not scanning this folder.
The users have Read, Write as well as Delete access to this particular
folder.

All help will be greatly appreciated.

Thanks and Regards,
Sandy

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default Original Excel File gets deleted and temp file gets created.

You might try putting a check in the code to see if the file is open (in
use) before the save takes place. If it is open, you could prompt the user
to try again later (but prevent anything else from happening if it is opened
by someone else). Here is a link to get you started.

http://www.vbaexpress.com/kb/getarticle.php?kb_id=625

"Sandy" wrote in message
oups.com...
Guys,

I have a major problem with an Excel workbook that i created and have
been try to resolve this issue for a couple of weeks and my Bosses are
breathing down my neck.

Here is how it works:
I have multiple users using the excel workbook at the same time (they
will open as read only). Once they are done with the data entry they
run a macro. Which will copy data from this excel workbook opens
another file, which is saved in the Shared Drive (Network Drive) and
pastes it as the last entry made in that workbook. If another user is
using this file then it throws an error boxing saying that, "The file
is locked by another user for editing and try after 10 seconds". Then
saves the workbook that it opened from the shared drive and closes it.

The problem is that the macro is running ok till the point of opening
the file making the entry but then when it tried to save the file it
creates a temp file in the same location instead and deletes the
original file. So when other users run the macro again the file does
not get located and they get Run Time error 1004.

This problem is only happening 5 to 10% of the times and usually occurs
when multiple users are trying to save the file at the same time.

I did read the previous threads, the suggestions i got from there we
It could be an Anti Virus issue. Norton is not scanning this folder.
The users have Read, Write as well as Delete access to this particular
folder.

All help will be greatly appreciated.

Thanks and Regards,
Sandy



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Original Excel File gets deleted and temp file gets created.

Thanks Mark will try this today and get back to u.....

Regards,
Sandy

Mark Ivey wrote:
You might try putting a check in the code to see if the file is open (in
use) before the save takes place. If it is open, you could prompt the user
to try again later (but prevent anything else from happening if it is opened
by someone else). Here is a link to get you started.

http://www.vbaexpress.com/kb/getarticle.php?kb_id=625

"Sandy" wrote in message
oups.com...
Guys,

I have a major problem with an Excel workbook that i created and have
been try to resolve this issue for a couple of weeks and my Bosses are
breathing down my neck.

Here is how it works:
I have multiple users using the excel workbook at the same time (they
will open as read only). Once they are done with the data entry they
run a macro. Which will copy data from this excel workbook opens
another file, which is saved in the Shared Drive (Network Drive) and
pastes it as the last entry made in that workbook. If another user is
using this file then it throws an error boxing saying that, "The file
is locked by another user for editing and try after 10 seconds". Then
saves the workbook that it opened from the shared drive and closes it.

The problem is that the macro is running ok till the point of opening
the file making the entry but then when it tried to save the file it
creates a temp file in the same location instead and deletes the
original file. So when other users run the macro again the file does
not get located and they get Run Time error 1004.

This problem is only happening 5 to 10% of the times and usually occurs
when multiple users are trying to save the file at the same time.

I did read the previous threads, the suggestions i got from there we
It could be an Anti Virus issue. Norton is not scanning this folder.
The users have Read, Write as well as Delete access to this particular
folder.

All help will be greatly appreciated.

Thanks and Regards,
Sandy


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Original Excel File gets deleted and temp file gets created.

Think Mark didn't understand the question. The code he sent you to is
worthless for the situation you describe.


http://support.microsoft.com?kbid=138621
XL: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=291295
XL2002: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=213383
XL2000: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=184982
WD97: VBA Function to Check If File or Document Is Open

Will be more along what you want to do as I understand the situation.

--
Regards,
Tom Ogilvy


"Sandy" wrote in message
ups.com...
Thanks Mark will try this today and get back to u.....

Regards,
Sandy

Mark Ivey wrote:
You might try putting a check in the code to see if the file is open (in
use) before the save takes place. If it is open, you could prompt the
user
to try again later (but prevent anything else from happening if it is
opened
by someone else). Here is a link to get you started.

http://www.vbaexpress.com/kb/getarticle.php?kb_id=625

"Sandy" wrote in message
oups.com...
Guys,

I have a major problem with an Excel workbook that i created and have
been try to resolve this issue for a couple of weeks and my Bosses are
breathing down my neck.

Here is how it works:
I have multiple users using the excel workbook at the same time (they
will open as read only). Once they are done with the data entry they
run a macro. Which will copy data from this excel workbook opens
another file, which is saved in the Shared Drive (Network Drive) and
pastes it as the last entry made in that workbook. If another user is
using this file then it throws an error boxing saying that, "The file
is locked by another user for editing and try after 10 seconds". Then
saves the workbook that it opened from the shared drive and closes it.

The problem is that the macro is running ok till the point of opening
the file making the entry but then when it tried to save the file it
creates a temp file in the same location instead and deletes the
original file. So when other users run the macro again the file does
not get located and they get Run Time error 1004.

This problem is only happening 5 to 10% of the times and usually occurs
when multiple users are trying to save the file at the same time.

I did read the previous threads, the suggestions i got from there we
It could be an Anti Virus issue. Norton is not scanning this folder.
The users have Read, Write as well as Delete access to this particular
folder.

All help will be greatly appreciated.

Thanks and Regards,
Sandy




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default Original Excel File gets deleted and temp file gets created.

Your absolutely right Tom...

I noticed the same thing after I had sent it. I actually sent the wrong
weblink. I had been referencing several before sending that post and
inserted the wrong link.

Thank you for supplying this information.

"Tom Ogilvy" wrote in message
...
Think Mark didn't understand the question. The code he sent you to is
worthless for the situation you describe.


http://support.microsoft.com?kbid=138621
XL: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=291295
XL2002: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=213383
XL2000: Macro Code to Check Whether a File Is Already Open

http://support.microsoft.com?kbid=184982
WD97: VBA Function to Check If File or Document Is Open

Will be more along what you want to do as I understand the situation.

--
Regards,
Tom Ogilvy


"Sandy" wrote in message
ups.com...
Thanks Mark will try this today and get back to u.....

Regards,
Sandy

Mark Ivey wrote:
You might try putting a check in the code to see if the file is open (in
use) before the save takes place. If it is open, you could prompt the
user
to try again later (but prevent anything else from happening if it is
opened
by someone else). Here is a link to get you started.

http://www.vbaexpress.com/kb/getarticle.php?kb_id=625

"Sandy" wrote in message
oups.com...
Guys,

I have a major problem with an Excel workbook that i created and have
been try to resolve this issue for a couple of weeks and my Bosses are
breathing down my neck.

Here is how it works:
I have multiple users using the excel workbook at the same time (they
will open as read only). Once they are done with the data entry they
run a macro. Which will copy data from this excel workbook opens
another file, which is saved in the Shared Drive (Network Drive) and
pastes it as the last entry made in that workbook. If another user is
using this file then it throws an error boxing saying that, "The file
is locked by another user for editing and try after 10 seconds". Then
saves the workbook that it opened from the shared drive and closes it.

The problem is that the macro is running ok till the point of opening
the file making the entry but then when it tried to save the file it
creates a temp file in the same location instead and deletes the
original file. So when other users run the macro again the file does
not get located and they get Run Time error 1004.

This problem is only happening 5 to 10% of the times and usually
occurs
when multiple users are trying to save the file at the same time.

I did read the previous threads, the suggestions i got from there
we
It could be an Anti Virus issue. Norton is not scanning this folder.
The users have Read, Write as well as Delete access to this particular
folder.

All help will be greatly appreciated.

Thanks and Regards,
Sandy








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Original Excel File gets deleted and temp file gets created.

Hey,

Thank you so much Mark and Tom for your help me thus far.

But I am still facing the same problem

This is the code that I am using:

Sub Test_DB2()
If
IsFileOpen("\\6.193.246.215\Border\Database\CEWAcc essDB2MervynsMexico.xls")
Then
MsgBox "The Database File is currently locked for Editing by
another user."
Range("A1").Select
End
Else
Application.Run ("Export_Data_Completed")
End If
End Sub

Function IsFileOpen(filename As String)
Dim filenum As Integer, errnum As Integer
On Error Resume Next
filenum = FreeFile()
Open filename For Input Lock Read As #filenum
Close filenum
errnum = Err
On Error GoTo 0
Select Case errnum
Case 0
IsFileOpen = False
Case 70
IsFileOpen = True
Case Else
Error errnum
End Select
End Function


Sub Export_Data_Completed()
Sheets("Decision").Select
Sheets("Database").Select
Range("Export_Database").Select
Selection.Copy
Workbooks.Open
filename:="\\6.193.246.215\Border\Database\CEWAcce ssDB2MervynsMexico.xls"
Range("A1").Select
Selection.End(xlDown).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False
Application.CutCopyMode = True
ActiveWorkbook.Save
ActiveWorkbook.Close
Sheets("Welcome").Select
End Sub

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Original Excel File gets deleted and temp file gets created.

Guys,

Any thoughts here.Need help bad....

thxs.
Sandy

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default Original Excel File gets deleted and temp file gets created.

Sandy,

I have been looking over your macro...

A few questions...
1. What is the name of the workbook you want to tranfer data from?
2. What is the worksheet(s) name(s) you wish to transfer data from?
3. What is the path and worksheet name you wish to transfer data to?
4. Are there named ranges associated with any of this data?

If you can answer these questions, I will give it a go to see if I can help
you out.

Mark Ivey
--
Mark Ivey


"Sandy" wrote:

Guys,

Any thoughts here.Need help bad....

thxs.
Sandy


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default Original Excel File gets deleted and temp file gets created.

Sandy...

It might be even better if you can email me a copy of the files you are
working with.


Mark Ivey


"Sandy" wrote in message
oups.com...
Guys,

Any thoughts here.Need help bad....

thxs.
Sandy



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Original Excel File gets deleted and temp file gets created.

hey Mark,

Sent you an email. Please do let me know what you think.

Thank you for helping out.

Regards,
Sandy



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default Original Excel File gets deleted and temp file gets created.

Sandy,

I think the problem is more of your network address convention. I tried it
out using my local drives and one network drive that I have mapped in with a
letter and had absolutely no problems. You might do well to re-ask your
question (with code) about the proper method to address the network drive
you are using. I have limited experience in that area, and it might take me
much longer to get you fixed up than the others that are always part of this
newsgroup.

Mark Ivey


"Sandy" wrote in message
ups.com...
hey Mark,

Sent you an email. Please do let me know what you think.

Thank you for helping out.

Regards,
Sandy



  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Original Excel File gets deleted and temp file gets created.

hey Guys,

Can anyone help me put here.. I am stuck big time.

Regards,
Sandy

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
Excel File saved as Temp file DennisM New Users to Excel 1 January 7th 10 04:56 PM
Problem using obj.Namespace(sourceFileName) Namespace(DestinationFilename).Itemsand then opening the xls file which creates a Temp Folder inside Temp Yuvraj Excel Discussion (Misc queries) 3 May 3rd 09 11:59 AM
Why is my macro looking for the original file I created it on? Brett Smith[_2_] Excel Programming 1 January 3rd 06 11:02 PM
auto save excel file every 10 minutes to its original file name MEG Excel Discussion (Misc queries) 3 September 8th 05 07:12 PM
Excel renaming file to a temp and deletes original (long) John Excel Programming 1 June 16th 04 08:57 PM


All times are GMT +1. The time now is 03:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"