Expandable Excel Table to Word Document2019 Community Moderator ElectionHow to create Excel (.XLS and .XLSX) file in C# without installing Ms Office?How do you display code snippets in MS Word preserving format and syntax highlighting?Creating tables for copy from Word to ExcelWhat is the best way to insert source code examples into a Microsoft Word document?vba copy from word table to excelExcel to dynamic Word tablePasted linked Excel tables to WordReplace text in Word document from ExcelCreating Word documents from excel tableCan I use links to Excel tables with paste special in Word?

Is this Paypal Github SDK reference really a dangerous site?

What is the purpose of a disclaimer like "this is not legal advice"?

Under what conditions can the right to be silence be revoked in the USA?

Why is there an extra space when I type "ls" on the Desktop?

Do Paladin Auras of Differing Oaths Stack?

Either of .... (Plural/Singular)

If sound is a longitudinal wave, why can we hear it if our ears aren't aligned with the propagation direction?

I am the person who abides by rules, but breaks the rules. Who am I?

How can I portion out frozen cookie dough?

Why do we say 'Pairwise Disjoint', rather than 'Disjoint'?

How to install round brake pads

Is "cogitate" used appropriately in "I cogitate that success relies on hard work"?

Is it a Cyclops number? "Nobody" knows!

Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?

Is it possible to clone a polymorphic object without manually adding overridden clone method into each derived class in C++?

Difference between `nmap local-IP-address` and `nmap localhost`

How do spaceships determine each other's mass in space?

Is there a way to make cleveref distinguish two environments with the same counter?

How would an energy-based "projectile" blow up a spaceship?

How do I raise a figure (placed with wrapfig) to be flush with the top of a paragraph?

What is this tube in a jet engine's air intake?

Yet another question on sums of the reciprocals of the primes

Insult for someone who "doesn't know anything"

Volume of hyperbola revolved about the y -axis



Expandable Excel Table to Word Document



2019 Community Moderator ElectionHow to create Excel (.XLS and .XLSX) file in C# without installing Ms Office?How do you display code snippets in MS Word preserving format and syntax highlighting?Creating tables for copy from Word to ExcelWhat is the best way to insert source code examples into a Microsoft Word document?vba copy from word table to excelExcel to dynamic Word tablePasted linked Excel tables to WordReplace text in Word document from ExcelCreating Word documents from excel tableCan I use links to Excel tables with paste special in Word?










0















I need to link my Excel table in a Word document, but the option which is already in Word can only autorefresh a fix table size e.g. if I copy a 4x4 Table from Excel and paste it with link into Word it will stay 4x4. Only these cells can be refreshed, if I add a column or a row in Excel it doesn't appear in Word.



I hope you got my problem :D










share|improve this question









New contributor




HKK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Double click on the table in Word. Then use the anchor points to expand (or contract it) as needed

    – cybernetic.nomad
    Mar 6 at 16:47















0















I need to link my Excel table in a Word document, but the option which is already in Word can only autorefresh a fix table size e.g. if I copy a 4x4 Table from Excel and paste it with link into Word it will stay 4x4. Only these cells can be refreshed, if I add a column or a row in Excel it doesn't appear in Word.



I hope you got my problem :D










share|improve this question









New contributor




HKK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Double click on the table in Word. Then use the anchor points to expand (or contract it) as needed

    – cybernetic.nomad
    Mar 6 at 16:47













0












0








0








I need to link my Excel table in a Word document, but the option which is already in Word can only autorefresh a fix table size e.g. if I copy a 4x4 Table from Excel and paste it with link into Word it will stay 4x4. Only these cells can be refreshed, if I add a column or a row in Excel it doesn't appear in Word.



I hope you got my problem :D










share|improve this question









New contributor




HKK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I need to link my Excel table in a Word document, but the option which is already in Word can only autorefresh a fix table size e.g. if I copy a 4x4 Table from Excel and paste it with link into Word it will stay 4x4. Only these cells can be refreshed, if I add a column or a row in Excel it doesn't appear in Word.



I hope you got my problem :D







excel vba ms-word document ole






share|improve this question









New contributor




HKK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




HKK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Mar 6 at 19:46









Cindy Meister

15.7k102337




15.7k102337






New contributor




HKK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Mar 6 at 15:42









HKKHKK

43




43




New contributor




HKK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





HKK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






HKK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Double click on the table in Word. Then use the anchor points to expand (or contract it) as needed

    – cybernetic.nomad
    Mar 6 at 16:47

















  • Double click on the table in Word. Then use the anchor points to expand (or contract it) as needed

    – cybernetic.nomad
    Mar 6 at 16:47
















Double click on the table in Word. Then use the anchor points to expand (or contract it) as needed

– cybernetic.nomad
Mar 6 at 16:47





Double click on the table in Word. Then use the anchor points to expand (or contract it) as needed

– cybernetic.nomad
Mar 6 at 16:47












2 Answers
2






active

oldest

votes


















0














As a user, it's possible to double-click on the Excel object to activate it, then drag the frame to expand/contract it in order to show a different number of rows and/or columns.



There is no equivalent for this in the Word object model - it can't be done using code. Unless...



The table has been inserted with a link and a Link field manages the link. In this case, it's possible to change the cell range specified in the Link field and the embedded object will resize when the field is updated.



For example, if the Link field code is for the range A1:B2



 LINK Excel.Sheet.12 C:\Test\TestMergeData.xlsx Sheet1!R1C1:R2C2 a p 


changing it to A1:C3 (R1C1:R3:C3) will display three rows and columns instead of two. (You can view and edit field codes by pressing Alt+F9.)



The VBA code would look like this:



Sub ChangeRangeLinkedExcel()
Dim fld As Word.Field
Dim ils As Word.InlineShape
Dim sFldCode As String
Dim posRangeStart As Long
Dim sLinkLeft As String, sRange As String, sLinkRight As String

For Each ils In ActiveDocument.InlineShapes
If ils.Type = 2 Then ' wdInlineShapeLinkedOLEObject
Set fld = ils.Range.Fields(1)
sFldCode = fld.code
posRangeStart = InStr(sFldCode, "!R")
sLinkLeft = Left(sFldCode, posRangeStart)
sRange = Mid(sFldCode, posRangeStart + 1, 9)
sLinkRight = Right(sFldCode, Len(sFldCode) - Len(sLinkLeft) - Len(sRange))
sRange = "R1C1:R3C3"
fld.code.Text = sLinkLeft & sRange & sLinkRight
fld.Update
End If
Next
End Sub


If the Excel object is not a Link field then the only possibility I've ever found to change what it displays using code is to delete the object, then recreate it. When the new embedded object is insert it will automatically display the specified number of rows and columns.






share|improve this answer






























    0














    Simply name the range in Excel before copying & pasting the link into Word. From then on, any changes to the scope or content of the named range in Excel will be reflected in Word.



    Alternatively, if you've already established the link, name the range in Excel, then edit the field code in Word. To do this, select the linked range and press Shift-F9. It should now appear as something like:



     LINK Excel.Sheet.12 "C:\Test\TestMergeData.xlsx" "Sheet1!R1C1:R2C2" a p 


    Change "Sheet1!R1C1:R2C2" (including the quotes) to your range name (without the quotes), then press F9 to refresh the link.






    share|improve this answer






















      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );






      HKK is a new contributor. Be nice, and check out our Code of Conduct.









      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55026936%2fexpandable-excel-table-to-word-document%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      As a user, it's possible to double-click on the Excel object to activate it, then drag the frame to expand/contract it in order to show a different number of rows and/or columns.



      There is no equivalent for this in the Word object model - it can't be done using code. Unless...



      The table has been inserted with a link and a Link field manages the link. In this case, it's possible to change the cell range specified in the Link field and the embedded object will resize when the field is updated.



      For example, if the Link field code is for the range A1:B2



       LINK Excel.Sheet.12 C:\Test\TestMergeData.xlsx Sheet1!R1C1:R2C2 a p 


      changing it to A1:C3 (R1C1:R3:C3) will display three rows and columns instead of two. (You can view and edit field codes by pressing Alt+F9.)



      The VBA code would look like this:



      Sub ChangeRangeLinkedExcel()
      Dim fld As Word.Field
      Dim ils As Word.InlineShape
      Dim sFldCode As String
      Dim posRangeStart As Long
      Dim sLinkLeft As String, sRange As String, sLinkRight As String

      For Each ils In ActiveDocument.InlineShapes
      If ils.Type = 2 Then ' wdInlineShapeLinkedOLEObject
      Set fld = ils.Range.Fields(1)
      sFldCode = fld.code
      posRangeStart = InStr(sFldCode, "!R")
      sLinkLeft = Left(sFldCode, posRangeStart)
      sRange = Mid(sFldCode, posRangeStart + 1, 9)
      sLinkRight = Right(sFldCode, Len(sFldCode) - Len(sLinkLeft) - Len(sRange))
      sRange = "R1C1:R3C3"
      fld.code.Text = sLinkLeft & sRange & sLinkRight
      fld.Update
      End If
      Next
      End Sub


      If the Excel object is not a Link field then the only possibility I've ever found to change what it displays using code is to delete the object, then recreate it. When the new embedded object is insert it will automatically display the specified number of rows and columns.






      share|improve this answer



























        0














        As a user, it's possible to double-click on the Excel object to activate it, then drag the frame to expand/contract it in order to show a different number of rows and/or columns.



        There is no equivalent for this in the Word object model - it can't be done using code. Unless...



        The table has been inserted with a link and a Link field manages the link. In this case, it's possible to change the cell range specified in the Link field and the embedded object will resize when the field is updated.



        For example, if the Link field code is for the range A1:B2



         LINK Excel.Sheet.12 C:\Test\TestMergeData.xlsx Sheet1!R1C1:R2C2 a p 


        changing it to A1:C3 (R1C1:R3:C3) will display three rows and columns instead of two. (You can view and edit field codes by pressing Alt+F9.)



        The VBA code would look like this:



        Sub ChangeRangeLinkedExcel()
        Dim fld As Word.Field
        Dim ils As Word.InlineShape
        Dim sFldCode As String
        Dim posRangeStart As Long
        Dim sLinkLeft As String, sRange As String, sLinkRight As String

        For Each ils In ActiveDocument.InlineShapes
        If ils.Type = 2 Then ' wdInlineShapeLinkedOLEObject
        Set fld = ils.Range.Fields(1)
        sFldCode = fld.code
        posRangeStart = InStr(sFldCode, "!R")
        sLinkLeft = Left(sFldCode, posRangeStart)
        sRange = Mid(sFldCode, posRangeStart + 1, 9)
        sLinkRight = Right(sFldCode, Len(sFldCode) - Len(sLinkLeft) - Len(sRange))
        sRange = "R1C1:R3C3"
        fld.code.Text = sLinkLeft & sRange & sLinkRight
        fld.Update
        End If
        Next
        End Sub


        If the Excel object is not a Link field then the only possibility I've ever found to change what it displays using code is to delete the object, then recreate it. When the new embedded object is insert it will automatically display the specified number of rows and columns.






        share|improve this answer

























          0












          0








          0







          As a user, it's possible to double-click on the Excel object to activate it, then drag the frame to expand/contract it in order to show a different number of rows and/or columns.



          There is no equivalent for this in the Word object model - it can't be done using code. Unless...



          The table has been inserted with a link and a Link field manages the link. In this case, it's possible to change the cell range specified in the Link field and the embedded object will resize when the field is updated.



          For example, if the Link field code is for the range A1:B2



           LINK Excel.Sheet.12 C:\Test\TestMergeData.xlsx Sheet1!R1C1:R2C2 a p 


          changing it to A1:C3 (R1C1:R3:C3) will display three rows and columns instead of two. (You can view and edit field codes by pressing Alt+F9.)



          The VBA code would look like this:



          Sub ChangeRangeLinkedExcel()
          Dim fld As Word.Field
          Dim ils As Word.InlineShape
          Dim sFldCode As String
          Dim posRangeStart As Long
          Dim sLinkLeft As String, sRange As String, sLinkRight As String

          For Each ils In ActiveDocument.InlineShapes
          If ils.Type = 2 Then ' wdInlineShapeLinkedOLEObject
          Set fld = ils.Range.Fields(1)
          sFldCode = fld.code
          posRangeStart = InStr(sFldCode, "!R")
          sLinkLeft = Left(sFldCode, posRangeStart)
          sRange = Mid(sFldCode, posRangeStart + 1, 9)
          sLinkRight = Right(sFldCode, Len(sFldCode) - Len(sLinkLeft) - Len(sRange))
          sRange = "R1C1:R3C3"
          fld.code.Text = sLinkLeft & sRange & sLinkRight
          fld.Update
          End If
          Next
          End Sub


          If the Excel object is not a Link field then the only possibility I've ever found to change what it displays using code is to delete the object, then recreate it. When the new embedded object is insert it will automatically display the specified number of rows and columns.






          share|improve this answer













          As a user, it's possible to double-click on the Excel object to activate it, then drag the frame to expand/contract it in order to show a different number of rows and/or columns.



          There is no equivalent for this in the Word object model - it can't be done using code. Unless...



          The table has been inserted with a link and a Link field manages the link. In this case, it's possible to change the cell range specified in the Link field and the embedded object will resize when the field is updated.



          For example, if the Link field code is for the range A1:B2



           LINK Excel.Sheet.12 C:\Test\TestMergeData.xlsx Sheet1!R1C1:R2C2 a p 


          changing it to A1:C3 (R1C1:R3:C3) will display three rows and columns instead of two. (You can view and edit field codes by pressing Alt+F9.)



          The VBA code would look like this:



          Sub ChangeRangeLinkedExcel()
          Dim fld As Word.Field
          Dim ils As Word.InlineShape
          Dim sFldCode As String
          Dim posRangeStart As Long
          Dim sLinkLeft As String, sRange As String, sLinkRight As String

          For Each ils In ActiveDocument.InlineShapes
          If ils.Type = 2 Then ' wdInlineShapeLinkedOLEObject
          Set fld = ils.Range.Fields(1)
          sFldCode = fld.code
          posRangeStart = InStr(sFldCode, "!R")
          sLinkLeft = Left(sFldCode, posRangeStart)
          sRange = Mid(sFldCode, posRangeStart + 1, 9)
          sLinkRight = Right(sFldCode, Len(sFldCode) - Len(sLinkLeft) - Len(sRange))
          sRange = "R1C1:R3C3"
          fld.code.Text = sLinkLeft & sRange & sLinkRight
          fld.Update
          End If
          Next
          End Sub


          If the Excel object is not a Link field then the only possibility I've ever found to change what it displays using code is to delete the object, then recreate it. When the new embedded object is insert it will automatically display the specified number of rows and columns.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 6 at 19:46









          Cindy MeisterCindy Meister

          15.7k102337




          15.7k102337























              0














              Simply name the range in Excel before copying & pasting the link into Word. From then on, any changes to the scope or content of the named range in Excel will be reflected in Word.



              Alternatively, if you've already established the link, name the range in Excel, then edit the field code in Word. To do this, select the linked range and press Shift-F9. It should now appear as something like:



               LINK Excel.Sheet.12 "C:\Test\TestMergeData.xlsx" "Sheet1!R1C1:R2C2" a p 


              Change "Sheet1!R1C1:R2C2" (including the quotes) to your range name (without the quotes), then press F9 to refresh the link.






              share|improve this answer



























                0














                Simply name the range in Excel before copying & pasting the link into Word. From then on, any changes to the scope or content of the named range in Excel will be reflected in Word.



                Alternatively, if you've already established the link, name the range in Excel, then edit the field code in Word. To do this, select the linked range and press Shift-F9. It should now appear as something like:



                 LINK Excel.Sheet.12 "C:\Test\TestMergeData.xlsx" "Sheet1!R1C1:R2C2" a p 


                Change "Sheet1!R1C1:R2C2" (including the quotes) to your range name (without the quotes), then press F9 to refresh the link.






                share|improve this answer

























                  0












                  0








                  0







                  Simply name the range in Excel before copying & pasting the link into Word. From then on, any changes to the scope or content of the named range in Excel will be reflected in Word.



                  Alternatively, if you've already established the link, name the range in Excel, then edit the field code in Word. To do this, select the linked range and press Shift-F9. It should now appear as something like:



                   LINK Excel.Sheet.12 "C:\Test\TestMergeData.xlsx" "Sheet1!R1C1:R2C2" a p 


                  Change "Sheet1!R1C1:R2C2" (including the quotes) to your range name (without the quotes), then press F9 to refresh the link.






                  share|improve this answer













                  Simply name the range in Excel before copying & pasting the link into Word. From then on, any changes to the scope or content of the named range in Excel will be reflected in Word.



                  Alternatively, if you've already established the link, name the range in Excel, then edit the field code in Word. To do this, select the linked range and press Shift-F9. It should now appear as something like:



                   LINK Excel.Sheet.12 "C:\Test\TestMergeData.xlsx" "Sheet1!R1C1:R2C2" a p 


                  Change "Sheet1!R1C1:R2C2" (including the quotes) to your range name (without the quotes), then press F9 to refresh the link.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 6 at 21:45









                  macropodmacropod

                  2,7622310




                  2,7622310




















                      HKK is a new contributor. Be nice, and check out our Code of Conduct.









                      draft saved

                      draft discarded


















                      HKK is a new contributor. Be nice, and check out our Code of Conduct.












                      HKK is a new contributor. Be nice, and check out our Code of Conduct.











                      HKK is a new contributor. Be nice, and check out our Code of Conduct.














                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55026936%2fexpandable-excel-table-to-word-document%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

                      How to get text form Clipboard with JavaScript in Firefox 56?How to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I copy to the clipboard in JavaScript?How do I include a JavaScript file in another JavaScript file?Get the current URL with JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

                      Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme