#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
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 |
#3
|
|||
|
|||
Thanks Greg,
I'll try and get my head around that and see if I can incorporate it into my macro. Cheers! |
|
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 |
sumproduct formula to pull info from multiple sheets | Berk21 | Excel | 7 | 01-15-2012 11:41 AM |
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 |