I have a macro that moves all pictures and tables to a PowerPoint while capturing the figure name and number as well as the table name and number. I am pasting the tables in as .Shapes.PasteSpecial(ppPasteMetafilePicture).
This has worked great in the past but I have come across about 150 documents that need to be converted that contain tables that span more than one page. When the macro pastes the table it cuts off at the first page.
If I split the table using the macro it does not carry over the headers.
What I want is to be able to do is split this table into multiple slides per Word document page that it is on and include the headers of the table.
Since you're pasting as a picture the only possibility is to EDIT the Word tables. You'd need to read how many rows comprise the table header, copy those rows, deactivate the table header setting, then paste the row(s) at the top of each page. Then you can copy each page. At the end, close the document without saving so that the original still has the table headers.
Related
I have a MS Word document containing tables with Arabic text (i.e. the document is set for Right to Left). However I am working with this document on a computer set for English. There is a table with multiple rows and 3 columns. In some of the rows all three columns might be merged and in some other may be 2 columns.
I am trying to traverse through the table each row at a time as I want to automatically change some contents in the table if the row has two cells merged or none of the cells merged.
However both the below lines of VBA code throws the error
"Run time error 5941, The requested member of the collection does not
exist"
ThisDocument.Tables(1).Columns.Count
ThisDocument.Tables(1).Rows.Count
The above two lines work perfectly fine on a document with English text i.e. set for Left to Right.
Frequently in my job I need to generate reports with lots of tables of inputs and results. Especially for the result tables, one change in analysis may require editing a dozen spreadsheets. I'd like to create a macro in word that pulls in data from a spreadsheet, with each table on it's own tab, so that if I update any of those tables in excel the word document tables will also update. Given the number of tables/data points, I don't want to have to tell the macro to pull each single data point. The aim would be to reduce time and errors from manual entry.
I'm thinking this would involve the following steps, but not sure how to go about them:
1) Define the name/size for each table in word with matching name/size in excel
2) Tell the macro to pull the data into a table format
I'm not sure if this is possible as so far I've only seen how to insert a caption or a text box, not insert or update entire tables. Any help would be greatly appreciated!
Depending on what you're doing, you may not even need any VBA code.
If you copy a range from Excel and paste it into Word using Paste Special with the 'paste link' option, any subsequent changes in the Excel range will automatically be reflected in the document when the workbook is saved. And, if you name the range in Excel before copying/pasting, the Word content will expend/contract to reflect changes in the named range's scope in Excel. A variety of paste formats is supported.
Alternatively, you might use a DATABASE field in Word.
I have a large workbook that has several connections and queries to an Oracle database to gather data.
I have roughly 6 sheets in this workbook that contain my final data.
I would like to move all of this data to a PowerPoint presentation. I have seen many examples of how to move charts and graphs, but I have none of these in my workbook nor do I need them.
3 of my sheets display data generated by a pivot table on a separate sheet. I have done this because I am trying to avoid showing the pivot filter arrows.
The other three sheets are a table created from the Oracle query. Each sheet has a separate query to display data specific to a certain customer.
I would like to take the data I have in my spreadsheets and build tables in PowerPoint containing that data. I have tried importing the objects to PowerPoint, but since the data can change from minute to minute having to update the links and then refresh the data is rather clumsy. Also, I never know how many rows of data I will have. This is also due to the fact that the data can change minute by minute.
In short I am trying to look at Sheet one. Take all of the data there and build a table in PowerPoint to match. When building the table in PowerPoint only place a max number of 6 rows per PowerPoint slide. Continue to add slides until all of the data is moved.
You'll probably need to cobble together bits of the following that my friends Brian and Naresh have allowed my to post on the PowerPoint FAQ site I maintain, but between the two, it should get you there:
Controlling Office Applications from PowerPoint (by Naresh Nichani and Brian Reilly)
http://www.pptfaq.com/FAQ00795_Controlling_Office_Applications_from_PowerPoint_-by_Naresh_Nichani_and_Brian_Reilly-.htm
Where it starts: the DisplayData project by Naresh Nichani and Brian Reilly
http://www.pptfaq.com/FAQ00784_Where_it_starts-_the_DisplayData_project_by_Naresh_Nichani_and_Brian_Reilly.htm
I'm filling in a Word template with data that's been collected from user input. In particular a (variable) number of documents is chosen, and information about each document fills a row of a table.
I've bookmarked several items in the template and successfully filled information in the header from my macro, but the table I'm not so sure with. I bookmarked the first cell and tried tabbing (with Chr(9)) through, and also tried passing an array. (In the template the table has only a first row. Usually tabbing past the last column creates an additional row.)
I can retieve cell contents with
Word.Application.ActiveDocument.Tables(1).Cell(3, 1).Range.Text
but can't write to the any cell except the first, where I placed a bookmark.
Can anyone offer a possible solution to populate the table?
To populate table, use this code
ActiveDocument.Tables(1).Cell(1, 1).Range.Text = "Blah Blah"
This will write to the first cell in the first table. Use a loop to fill the rest of the cells.
I would also recommend see this link.
Topic: Automating Word Tables for Data Insertion and Extraction
Link: http://msdn.microsoft.com/en-us/library/aa537149%28v=office.11%29.aspx#Y1254
Extract:
Summary: Learn how to automate the creation and formatting of tables in Word. Get information about optimizing performance, populating a table with data, formatting table structure, linking table data, and extracting data from a table. (25 printed pages)
I've actually ran into a similar problem using Access to automate filling out a Word table template. I found that if I opened the template in Word prior to running the VBA script, then the Word document is successfully filled out with the table information. My code looks similar to yours as far as adding to it by row. Because the number of fields to be transferred to the form is dynamic it didn't seem like bookmarks for each section would work. If you have any update, I'd be happy to hear of a different way to resolve this.
VBA is a programming language so I'll assume this question is ok on SO.
What API calls and other techniques can I use, to extract specific tables from an MS-Word document?
I need to write a program which will open several Word documents, and look inside for tables which have a certain text in Row 1 Column 1, and output those tables to another file, preferrably as cells in an Excel spreadsheet.
Is this possible? How would you tackle this? Where to start?
Thanks
The Document.Tables collection contains all tables in a document.
Each Table in this collection has certain properties, such as .Rows, .Columns, or .Cell, which give access to a given row, a given column or a given cell.
The Table.Range.Copy method copies the given table to the clipboard.
The Worksheet.Paste method pastes the copied table into an Excel sheet, using the currently active cell as the insertion point.