You should open or create Word file using Excel code.
Find early and late binding method and read how to do it.
Moving Data from Excel to Word VBA
Hey folks.
I'm trying to get a macro in excel to run, then take the data the macro selects, put it into a word doc, and then have my word doc run a macro automatically. I used the record macro feature for both macros.
Excel Macro:
Range("A3:F3").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
End Sub
Word Macro:
Selection.WholeStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^t"
.Replacement.Text = ", "
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
I'm very new to VBA. I've tried some solutions I've found through google, but they always give me an error when I try to run them.
Developer technologies | Visual Basic for Applications
1 answer
Sort by: Most helpful
-
Oskar Shon 866 Reputation points
2022-11-08T19:08:32.297+00:00