View Single Post
 
Old 06-24-2015, 02:59 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,340
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Without knowing what you want to execute, it's impossible to give any advice. However, unloading the form as your post indicates before executing its code is liable to result in the code not being executed.

Also, you don't need to change folders via ChangeFileOpenDirectory. You can open the file explicitly. Nor do you need to copy & paste. Try, for example:
Code:
Sub CheckBox1_Click()
Dim DocSrc As Document, DocTgt As Document
Const StrFld As String = "X:\sconner\CCD Damage Mechanisms\Data Transfer Practice\"
Set DocTgt = ActiveDocument
Set DocSrc = Documents.Open(FileName:=StrFld & "Mechanism Transfer Practice.docx", _
  ReadOnly:=False, AddToRecentFiles:=False)
DocTgt.Range.FormattedText = DocSrc.Range.FormattedText
DocSrc.Close
Unload Me
End Sub
PS: When posting code, please use the code tags, inserted via the # button on the posting menu.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote