Group:  Microsoft Access ยป microsoft.public.access.activexcontrol
Thread: Copy an open file

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Copy an open file
Daniel 20.11.2005 16:49:03
Hi,

Is there a way to copy an open file ?
Like opening it for Read Only and copy it's contents ?

Thanks,


Re: Copy an open file
"Alex Dybenko" <alexdyb[ at ]PLEASE.cemi.NO.rssi.SPAM.ru> 20.11.2005 16:59:47
Hi,
you can use api to do so, look here:
http://www.mvps.org/access/api/api0026.htm

--
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com


"Daniel" <Daniel[ at ]discussions.microsoft.com> wrote in message
news:58B82AD5-3642-4E6D-BBAB-393B34735447[ at ]microsoft.com...
[Quoted Text]
> Hi,
>
> Is there a way to copy an open file ?
> Like opening it for Read Only and copy it's contents ?
>
> Thanks,
>
>

Re: Copy an open file
John Mishefske <jmishefskeNO[ at ]SPAMyahoo.com> 22.11.2005 07:09:11
Daniel wrote:
[Quoted Text]
> Hi,
>
> Is there a way to copy an open file ?
> Like opening it for Read Only and copy it's contents ?

No opinion on whether this is something you should do...

Private Declare Function apiCopyFile Lib "kernel32" Alias "CopyFileA" ( _
ByVal lpExistingFileName As String, _
ByVal lpNewFileName As String, _
ByVal bFailIfExists As Long) As Long

' Replacement for FileCopy command that allows an open file to be copied.
' Of course - you want to be careful using this since any change to the
' file while copying it can leave the new copy corrupted.
'
' from http://support.microsoft.com/default.aspx?scid=kb;EN-US;207703
Public Sub CopyFile(SourceFile As String, DestFile As String)
'---------------------------------------------------------------
' PURPOSE: Copy a file on disk from one location to another.
' ACCEPTS: The name of the source file and destination file.
' RETURNS: Nothing
'---------------------------------------------------------------
Dim Result As Long

If Len(Dir(SourceFile)) = 0 Then
MsgBox Chr(34) & SourceFile & Chr(34) & " is not valid file name.", _
vbOKOnly Or vbExclamation, App.Title
Else
' important - don't allow a "copy over" - it may destroy data
Result = apiCopyFile(SourceFile, DestFile, True) ' 3rd param - FailIfExists
End If

End Sub

--
'---------------
'John Mishefske
'---------------
Re: Copy an open file
"Alex Arkhipov" <arkhipov[ at ]bluebottle.com> 18.12.2005 02:42:51
Try selecting everything and press Control+C.
"Daniel" <Daniel[ at ]discussions.microsoft.com> wrote in message
news:58B82AD5-3642-4E6D-BBAB-393B34735447[ at ]microsoft.com...
[Quoted Text]
> Hi,
>
> Is there a way to copy an open file ?
> Like opening it for Read Only and copy it's contents ?
>
> Thanks,
>
>


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net