How To Copy A Single Excel Range To Word Using VBA

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ธ.ค. 2024

ความคิดเห็น •

  • @peteroakes6217
    @peteroakes6217 2 ปีที่แล้ว +1

    Hi, awesome tutorial! Is there a way to copy text from Excel into Word without the need to do it in a table format? I'm trying to make it so that my notes that have referenced formulas in them copy out correctly. Some of the numbers auto-update every month with new information but the words around them stays the same and I want to export everything into a word document for my notes. I can get it to work when I'm sending emails through outlook but I can't get the same thing to work using Word. Thanks.

  • @shalopayk793
    @shalopayk793 4 ปีที่แล้ว +1

    Thank you very much, you saved my lab work

  • @chapincougars
    @chapincougars 3 ปีที่แล้ว +1

    Thank you for posting this good information about how to code with VBA. Most of the time that you are importing excel data into word is because you have a form or report that your filling into. Could you please explain how you would open an existing word file and paste the single excel range where a word bookmark has been placed?

  • @JS-zb6zh
    @JS-zb6zh 5 ปีที่แล้ว

    thank you for the great video. I have a question how do you copy from an existing word document into PowerPoint. I assume the only way this can be done is to copy the range/table/text from word and paste it into excel and then from excel to PowerPoint. I have tried copying a range within a table in word to excel but I am unsure how to copy specific range in a word table. So far I have:
    Dim wdApp as Word.Application
    Dim Wdoc as Word.Document
    Set Wdoc=WdApp.Documents.open(MyFile)
    wDoc.Tables(1).cell(2,2).range.copy
    but i want to copy from cell(2,2) to cell(3,9)
    can you please advise me
    Wdoc.

    • @SigmaCoding
      @SigmaCoding  5 ปีที่แล้ว

      You would have to iterate through the cells one by one and copy the information from each cell.

    • @JS-zb6zh
      @JS-zb6zh 5 ปีที่แล้ว +1

      @@SigmaCoding Thanks I figured it out eventually

  • @ignacioa3698
    @ignacioa3698 5 ปีที่แล้ว

    I noticed that in this video you did not have a third Word variable for the range portion. Why not?
    Is that because in this example you don’t need to set it up as a variable since you’re not doing any additional formatting of that range object after you’ve pasted it on to the Word document?

    • @SigmaCoding
      @SigmaCoding  5 ปีที่แล้ว

      The reason I don't declare the range object in this example, is that I don't plan to work with it directly. When I say work with it directly, I mean working with multiple properties or methods that belong to the object specifically. If I had planned to work with it directly, I probably would've declared it as a variable up above. I don't technically have to but if I want to leverage Intellisense or just write my code more concisely I would declare the variable. That is a good catch though and it's a fair question to ask because you'll see people approach it differently. If you wanted to declare the object you absolutely could and it would work the same.

    • @ignacioa3698
      @ignacioa3698 5 ปีที่แล้ว

      @@SigmaCoding Got it! Thank you!

  • @MohAboAbdo
    @MohAboAbdo 3 ปีที่แล้ว

    Thank you so much