Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-23-2015, 08:00 AM
shabbaranks shabbaranks is offline FileCopy from a check box Windows 7 64bit FileCopy from a check box Office 2007
Advanced Beginner
FileCopy from a check box
 
Join Date: Mar 2011
Posts: 89
shabbaranks is on a distinguished road
Default FileCopy from a check box


Hi,

Just looking at creating a document which - when the user puts a check in the document it initiates a file copy and copies a particular document to the same folder the current document is in.

But I cant see exactly how I execute this?

Thanks
Reply With Quote
  #2  
Old 11-23-2015, 08:22 AM
shabbaranks shabbaranks is offline FileCopy from a check box Windows 7 64bit FileCopy from a check box Office 2007
Advanced Beginner
FileCopy from a check box
 
Join Date: Mar 2011
Posts: 89
shabbaranks is on a distinguished road
Default

Getting closer, what I would like to do is use the active document path as the destination

Code:
Sub CopyDocument()
Dim SourceFile, StrDestinationFile As String
SourceFile = "pRINTERS.docx" 
StrDestinationFile = ActiveDocument.Path
FileCopy "P:\pRINTERS.docx", StrDestinationFile
End Sub
Reply With Quote
  #3  
Old 11-23-2015, 08:28 AM
shabbaranks shabbaranks is offline FileCopy from a check box Windows 7 64bit FileCopy from a check box Office 2007
Advanced Beginner
FileCopy from a check box
 
Join Date: Mar 2011
Posts: 89
shabbaranks is on a distinguished road
Default

Got it working:

Code:
Sub CopyDocument()
Dim strSourceFile, StrDestinationFile As String
strSourceFile = "P:\pRINTERS.docx"
StrDestinationFile = ActiveDocument.Path & "\pRINTERS.docx"
FileCopy strSourceFile, StrDestinationFile
End Sub
Just need to link it to the checkbox on the document now
Reply With Quote
  #4  
Old 11-24-2015, 01:58 AM
shabbaranks shabbaranks is offline FileCopy from a check box Windows 7 64bit FileCopy from a check box Office 2007
Advanced Beginner
FileCopy from a check box
 
Join Date: Mar 2011
Posts: 89
shabbaranks is on a distinguished road
Default

Sorted - probably quite long winded but it works

Code:
Private Sub CheckBox1_Click()
Dim strSourceFile As String
Dim StrDestinationFile As String
If Me.CheckBox1 = True Then
strSourceFile = "P:\Test Word Document.docx"
StrDestinationFile = ActiveDocument.Path & "\Test Word Document.docx"
FileCopy strSourceFile, StrDestinationFile
Else
If Me.CheckBox1 = False Then
If Not Dir(ActiveDocument.Path & "\Test Word Document.docx", vbDirectory) = vbNullString Then Kill (ActiveDocument.Path & "\Test Word Document.docx")
End If
End If
End Sub
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
FileCopy from a check box VBA FileCopy Source: problem landonminden Word VBA 4 12-16-2015 01:02 AM
FileCopy from a check box Excel vba to check to check if two columns are empty subspace3 Excel Programming 5 07-09-2015 04:45 PM
Multiple Check In/check Out Times big0 Excel 4 09-19-2013 05:02 AM
FileCopy from a check box cannot check/uncheck check box but added check box learn2office Word 1 11-27-2012 02:02 AM
Link word check box to access check box Mrkieth Word 4 01-30-2012 06:43 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:10 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft