Consulting

Results 1 to 3 of 3

Thread: Making one Macro execute in Excel then Word

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Making one Macro execute in Excel then Word

    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. My job has us open an excel file, copy the range of cells listed in the macro above, then paste them in word and do a find all and replace. Ideally, I'd like to be able to just use one macro in excel to do the entire process. Any help is appreciated! The stuff I've found from google hasn't been helpful so far.
    Last edited by Aussiebear; 11-03-2022 at 05:05 PM. Reason: Added code tags to supplied code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •