Forum Discussion
Help with Paste from excel to word
- Sep 22, 2022
Tommaso_Bertocchi I apologize in advance if this makes you cry.
Using Visual Basic in Word, you can add a table to a document using a command such as
The table will be added to the Range, which can be defined in a number of ways. For example if the table was to be added at the end of the document, you would use
Dim NewTable As Table
Dim tblRange As Range
Set tblRange = ActiveDocument.Range
tblRange. Collapse wdCollapseEnd
Set NewTable = ActiveDocument.Tables.Add(tblRange, NumRows, NumColumns, etc)
While you would usually set the tolal number of columns when adding the table, in most cases you would not set the total number of rows as you can simply use
NewTable.Rows.Add
whenever a new row is required.
The following is a listing of the members of the Table class
As an example, this is a screen shot of onw of the tables in an 1100 page document that was created, populated with text and formatted using a visual basic routine run from an Access database
each file have a huge list of components and stuff, with obviously a huge amount of formula
i cant see how i could do the same from word... how can i even tell to word wich files he have to open to make calculations and extract data?
im confused..
A. In the same way that you tell Excel which files have to be opened and which calculations have to be made to extract the data into the workbook that contains the table that you are now manually copying and pasting into Word.
I realise that you probably have quite an investment in the system that you have already developed and thus can understand the reluctance to develop an alternative. However, that does not mean that it cannot be done.
- Tommaso_BertocchiSep 22, 2022Copper Contributori will further investigate and learn, i really appreciate your help sir!
anyway we didnt discover why the hell it paste in a wrong way on word2016 but works fine on word2010! not a big deal, i will find a work-around - Sep 22, 2022
Tommaso_Bertocchi I apologize in advance if this makes you cry.
Using Visual Basic in Word, you can add a table to a document using a command such as
The table will be added to the Range, which can be defined in a number of ways. For example if the table was to be added at the end of the document, you would use
Dim NewTable As Table
Dim tblRange As Range
Set tblRange = ActiveDocument.Range
tblRange. Collapse wdCollapseEnd
Set NewTable = ActiveDocument.Tables.Add(tblRange, NumRows, NumColumns, etc)
While you would usually set the tolal number of columns when adding the table, in most cases you would not set the total number of rows as you can simply use
NewTable.Rows.Add
whenever a new row is required.
The following is a listing of the members of the Table class
As an example, this is a screen shot of onw of the tables in an 1100 page document that was created, populated with text and formatted using a visual basic routine run from an Access database
- Tommaso_BertocchiSep 22, 2022Copper Contributori take 5 more minutes, if you dont mind, to try to better ubnderstand the basics and then i will try to learn by myself
with excel i can easily define ranges/cells, and then choose where and how to insert data/text/pictures
you telling me i can do the same on word? lets say i have something like this..
here some text already written in word
here i want to build/insert a table with energy comsumption or whatever data
here some more text already written in the document
is it possible to actually make a macro that create the table in the right place??
if the answer is yes i will cry because i invested so many hours in excelt thinking it was not possible to do so.....
(another big question is.. how can word knows where to find the files? on excel is easy because i literally link (trough macro) the files, so the user doesnt have to manually write any filepath or whatever)