Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2006

Tip: Looking for answers? Try searching our database.

copying files form within Word

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
aalaan - 19 Nov 2006 20:09 GMT
Hi all

Word 2000. Complete beginner.

Trying to automate the current process of leaving Word and going into
Windows Explorer to copy files that have just been worked on to a memstick
(removable media). This is because one should never *save* to a memstick.

I'm trying to automate this from a special button on the Word toolbar while
actually in a given document. I know a file must be actually there on the
hard disk (ie first saved to the hard disk) and then it should be possible
to copy it. However, doing it from inside the document means that the system
thinks the document is still in use and refuses to copy it (copying an'open'
file). How can I overcome this?

I'm familiar with assigning a vba routine to a new toolbar button.

Here is the code I'm using:

Dim strFileA, strFileB

     strFileA = ActiveDocument.Name            'so as know the name of the
document being copied
     ActiveDocument.Close                            'so the system thinks
it is still not open
     strFileB = "F:\" & strFileA                        'the path of the
desired copy
     FileSystem.FileCopy strFileA, strFileB     'overwrite by default

I get 'permission denied' which I guess is the system saying this file is in
use (and therefore locked).

Any help would be appreciated.
Helmut Weber - 19 Nov 2006 20:35 GMT
Hi,

save the file as A,
save the file as B,
copy file A.

Do with B whatever you like.

HTH

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.