Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-18-2015, 04:17 AM
Patrick Innes Patrick Innes is offline Macro to copy cell info to multiple documents Windows 7 32bit Macro to copy cell info to multiple documents Office 2013
Novice
Macro to copy cell info to multiple documents
 
Join Date: Feb 2015
Posts: 2
Patrick Innes is on a distinguished road
Default Macro to copy cell info to multiple documents

Hello,

With the rise in Work Health Safety, we are now using a Table at the top of each of our Safe Work Method Statements (SWMS) that shows info such as: Building Site, Person Responsible, etc. Since some of the cells in the Table have the same information in every SWMS, it would be great to be able to copy the text in a cell from say Table 1 Row 2 Col 3 from a Master SWMS .docm to the same positioned cell in Table 1 of all the other .docm SMWS that are in the same folder.


Is there an easy way to write this for Word 2013? (I seem to have a lot of code at it doesn't work!)



Cheers Patrick
Reply With Quote
  #2  
Old 02-18-2015, 01:33 PM
gmaxey gmaxey is offline Macro to copy cell info to multiple documents Windows 7 32bit Macro to copy cell info to multiple documents Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim strPath As String, strFileName As String
Dim oDoc As Word.Document
  strPath = ThisDocument.Path & Application.PathSeparator
  strFileName = Dir$(strPath & "*.doc")
  While Len(strFileName) <> 0
    If Not strFileName = ThisDocument.Name Then
      Set oDoc = Documents.Open(strFileName, , , False, , , , , , , , False)
      On Error Resume Next
      oDoc.Tables(1).Cell(3, 3).Range.Text = _
         Left(ThisDocument.Tables(1).Cell(2, 3).Range.Text, Len(ThisDocument.Tables(1).Cell(2, 3).Range.Text) - 2)
      On Error GoTo 0
      oDoc.Close wdSaveChanges
    End If
    strFileName = Dir$()
  Wend
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 02-18-2015, 08:38 PM
Patrick Innes Patrick Innes is offline Macro to copy cell info to multiple documents Windows 7 32bit Macro to copy cell info to multiple documents Office 2013
Novice
Macro to copy cell info to multiple documents
 
Join Date: Feb 2015
Posts: 2
Patrick Innes is on a distinguished road
Default

Thanks Greg,

I'll try and get my head around that and see if I can incorporate it into my macro.

Cheers!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for find/replace (including headers and footers) for multiple documents jpb103 Word VBA 2 05-16-2014 04:59 AM
Macro to copy formula from one cell to another anwar Excel Programming 1 04-25-2014 08:27 PM
Macro to copy cell info to multiple documents sumproduct formula to pull info from multiple sheets Berk21 Excel 7 01-15-2012 11:41 AM
Macro to copy cell info to multiple documents Copy table cell formatting across multiple cells / tables pakistanray Word Tables 2 10-31-2011 08:07 AM
copy cell from sheet 2 to sheet 3 macro slipperyjim Excel Programming 1 02-18-2010 01:31 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:21 AM.


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