I don't understand why I am getting an error when I run this bit of code:
CODE
LabelName ="BITMAP.BMP" 'set elsewhere in the code
CopyTo = "\\Serveurwin\Fortune\LabelBitmaps\" & LabelName
Try
File.Copy("C:\Temp\tmp001.bmp", CopyTo, True)
Catch ex As Exception
MsgBox(ex.ToString, MsgBoxStyle.Exclamation)
End Try
It works fine for the first time, but if I try to overwrite the previous file I get an error saying that the file is in use by another process and cannot be copied. I tried it with the directory mapped to a drive letter with the same result. However if I set the destination to a local directory there is no problem.
This would usually indicate a problem with permissions, but if that was the case why can I create the file once then not be able to overwrite it? I have checked the settings on the server. The directory is supposed to be full access. I can overwrite the updated file by dragging it from my local drive to the server, so it should not be a permissions problem.
Just to be clear on what I am doing here.
The .bmp is generated on my local drive then when I hit save, the temporary bitmap file is copied to the server with an autogenerated name. When I modify then save again it is supposed to overwrite the previous file with the newly generated bitmap.
Any ideas?
RC