Export Table To Word Excel VBA Macro

Поделиться
HTML-код
  • Опубликовано: 23 июл 2024
  • Excel macro/VBA code available in this post: excelmacroclass.blogspot.com/...
    We often copy/paste data, tables, and charts, from Excel to Word documents. In this video we see how to automate that process with VBA macros. The code copies a range with data in Excel, and pastes the content as a table in a Word document. The process can repeat or loop to copy various tables. The macro can be leveraged to copy other elements such as charts.
    You can find many other macro examples and Excel VBA learning materials (including the Excel VBA Guide for Beginners) in the blog under the link: excelmacroclass.blogspot.com
    And yet, if you want more, you can find various Excel applications of different nature in the other blogs of the Excel Macro Mania saga:
    Excel Macro Fun (excelmacrofun.blogspot.com/)
    Excel Macro Business (excelmacrobusiness.blogspot.com/)
    Excel Macro Sports (excelmacrosports.blogspot.com/)

Комментарии • 12

  • @MohAboAbdo
    @MohAboAbdo Год назад +1

    Excellent video, thank you very much sir.

  • @PiyushMedicalKnowledge
    @PiyushMedicalKnowledge Год назад +1

    Good video bro

  • @user-qq5lq1qo2n
    @user-qq5lq1qo2n 7 месяцев назад

    what to do if i have bulk email address any changes is command ?

    • @ExcelMacroMania
      @ExcelMacroMania  6 месяцев назад

      I think you refer to another video, the one to send email from Excel? To send multiple emails check out this other video: ruclips.net/video/XpGzWvSr9j4/видео.htmlsi=DQ9Iki_DeyKsoea8

  • @ricksonppereira
    @ricksonppereira 6 месяцев назад

    how about to send to an specific word document? I mean, I have a bottom that I ask the name of the document, and I open this Userform in excel vba, and after I answer the "the name of the word document" I want to send the excel table to this specific document, how I do this?

    • @ExcelMacroMania
      @ExcelMacroMania  6 месяцев назад

      Instead or wordApp.Documents.Add you need to use wordApp.Documents(docName).Select, where docName is the name of the word document with extension (for example "mydoc.docx") assuming it is open.

    • @ricksonppereira
      @ricksonppereira 6 месяцев назад

      ​@@ExcelMacroMania That ain't working bro, check it yourself maybe you will notice and help me, and in this case it only will work for one specific docs name? I want to submiss the name of the doc on an userform and then find the doc (the doc could also already be open) and send the excel table, got it? I got other code here similar to this, but I can't do this last part

    • @ExcelMacroMania
      @ExcelMacroMania  6 месяцев назад

      @@ricksonppereira Should work if the doc gets open from within the macro... try to implement this:
      1. get name of folder and file
      docPath = "C:\Users\username\documents...."
      docName = "test.docx"
      2. create an instance of word application and open the doc (you can open any doc you want, or as many as you want.
      Set wordApp = CreateObject("Word.Application")
      With wordApp
      .Visible = True
      .Documents.Open docPath & Application.PathSeparator & docName
      End With
      3. copy the range or table you want to paste as picture
      Range("A1:D12").CopyPicture
      4. paste in the document you want (previously open within the same macro in point 2). Note that here you use only docName, as it's already open you don't need here the whole path.
      With wordApp
      .Documents(docName).Select
      .Selection.Paste
      End With
      5. Let me know if it works. Good luck!

  • @user-qq5lq1qo2n
    @user-qq5lq1qo2n 7 месяцев назад

    If you can put that command code in description so life would be more easy

    • @ExcelMacroMania
      @ExcelMacroMania  7 месяцев назад

      There is a link to the code in the description for all my videos! Here you go again: excelmacroclass.blogspot.com/2023/03/export-table-to-word-excel-vba-macro.html

  • @simracer1256
    @simracer1256 3 месяца назад

    Are you on glue?