Can't copy file after recent modification 
Author Message
 Can't copy file after recent modification

I'm not sure if this is really a VB question or a Windows question, but
please bear with me.  (Also pardon the dual-post, but I figured this might
be something only a beginner would mess up, or perhaps only someone with
experience could help with.)

My environment involves original files of type A stored on a server in
directory A.

The originals are modified then saved with " wo" added at the end (e.g.
"sample.doc" becomes "sample wo.doc") in Directory B.  At this point they
are type B files.

The related type A file then needs to be moved to the B directory.

This is the code I wrote.  It works inconsistently.*

'----------
Sub movefile()
Dim lname$, sname$, fnl%

lname$ = ActiveDocument.Name
fnl% = Len(lname$)
If Right$(lname$, 7) = " wo.doc" Then
sname$ = Left$(lname$, (fnl% - 7))
FileCopy "\\Server\A\" & sname$ & ".doc", "\\Server\B\" & sname$ & ".doc"
Kill "\\Server\A\" & sname$ & ".doc"
Else
MsgBox "Your file must end in ' wo.doc' for this funtion to work."
End If
End Sub
'----------

*If I don't modify the A file before saving it as B, it works fine.  Also,
if I modify A, save as B, close B, reopen B, and run the code, it works
fine.



Sat, 07 Feb 2004 05:43:39 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. 'Canned' data in VB program

2. Copy a bunch of files but can't cancel in the middle of copy

3. API call to get 'Recent Documents'

4. API call to get 'Recent Documents'

5. How to copy/append entire record with modification to one field

6. Cans access2.0 engine access btrieve files?

7. Preventing files appearing in recent files list

8. Recent File list on the File Menu

9. Rich Text File (.RTF) -Can't copy multiple .rtf files

10. Rich Text File (.RTF) -Can't copy multiple .rtf files (VB 6.0 Enterprise)

11. Modifications don't appear in the right window

12. Eviter la modification du curseur de la souris lors d'une requete

 

 
Powered by phpBB® Forum Software