Moving Data from Excel to Word VBA

Zac 1 Reputation point
2022-11-02T22:39:51.51+00:00

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
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Oskar Shon 866 Reputation points
    2022-11-08T19:08:32.297+00:00

    You should open or create Word file using Excel code.
    Find early and late binding method and read how to do it.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.