View Full Version : just a designer, need help with a macro for word
justdesign
03-12-2014, 07:54 AM
Can anyone enlighten me how to get a macro for word that insert legends information at the end of the document according to the text in a specific column.
Cheers a lot!
fumei
03-12-2014, 11:02 AM
Start by stating EXACTLY what you want to happen. "according to the text in a specific column." is vague.
gmaxey
03-12-2014, 08:21 PM
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oCol As Column
Dim oRng As Word.Range
Dim i As Long
'I get to determine the specific column.
Set oCol = ActiveDocument.Tables(1).Columns(2)
For i = 1 To oCol.Cells.Count
Set oRng = oCol.Cells(i).Range
oRng.End = oRng.End - 1
ActiveDocument.Range.InsertAfter oRng.Text & vbCr
Next i
End Sub
justdesign
03-14-2014, 08:45 AM
Cheers!
or
Sub M_snb()
for each cl in ActiveDocument.Tables(1).Columns(2).cells
c00=c00 & cl.range.text
next
activedocument.content.insertafter replace(c00,chr(7),"")
End Sub
or
Sub tst()
with ThisDocument
.Tables(1).Columns(3).Select
Selection.Copy .Content.InsertAfter vbCr & vbCr
.Paragraphs.Last.Range.Paste
end with
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.