How do I run a macro automatically when a cell changes?

How do I run a macro automatically without opening Excel?

I'm trying to write a macro to create a table in a word document that has all of my data in an Excel spreadsheet. I have over 200 records so it would be difficult to just copy and paste. I want to automate this process.

I'm running the macro from within VBHere is my code: Sub CreateWordDocTable(). Set wdDoc = wdApp.Documents.Add
Set wdApp = Nothing. Set wdDoc = Nothing. End Sub. You can just call the macro from inside Excel. I would make sure that you make the macro accessible from Word, but not from Excel. I also would suggest calling your macro from a different module, not your current one.

I think you're going to want something like this: Sub Wordmacro(). ' Make sure this is only accessible from Excel. Private Sub WorkbookOpen(). Call Wordmacro. End Sub. ' This is the macro you want to call. Sub Wordmacro(). Dim wdApp As Word.Application Dim wdDoc As Word.Document Dim wdRange As Word.Range Set wdApp = New Word.Application Set wdDoc = wdApp.Add ' Set the range. Set wdRange = wdDoc.Content ' Do whatever you want here. ' Put your data into the range. wdRange.InsertBreak wdDoNotInsertBreaks ' Close the range

Related Answers

Why won't macros work in Excel on Mac?

Macro (aka VBA) can be used to execute code automatically in Excel. This...

Does Excel 2016 have Macros?

After I used the Microsoft Office Assistant tool to clean up my Excel spreads...

Is Excel macro a skill?

In the past couple of years I've noticed people refer to two...