Please can anyone help? I've searched high and low for a solution without success. Hopefully the attached photos will explain better. An example of the text string would be the term "Is the". The idea is to have the TEXT | TEXT rows set up with a longer first column (15cm) and a shorter second column (2.78cm) whilst the TEXT | PHOTO rows stay as they are. I'd like to repeat this for all rows and all tables. I'd like to create a macro that searches for a specific string within a sentence with a cell, and then change the cell width of both cells within the row.
![conflence import word document headings conflence import word document headings](http://kb.mit.edu/confluence/download/attachments/159391373/04b-edit-and-modify-the-adobe-pdf-in-word-100767678-large.jpg)
The tables all have two columns and several rows, but some have rows which are TEXT | TEXT whilst some are TEXT | PHOTO. I have a document containing several tables containing both text and photos.
CONFLENCE IMPORT WORD DOCUMENT HEADINGS CODE
I am a newbie to vba code but have had some marginal success with basic macros for changing the format of tables, text and photos within Word documents. I type in the formula using a macro recorder. When my code shows: "=IFNA(VLOOKUP(" & m圜ell.Address(RowAbsolute:=False, ColumnAbsolute:=False) & ",'D:\Users\Working'!C1:C59,15,0),"""")" This is what I want =IFNA(VLOOKUP(J1242,'D:\Users\Working'!$A:$BG,15,0),"") Set m圜ell = Application.InputBox( _ However, the cell will return the ' ' sign with the address I have a VBA which should prompt an input box, allow user to select a cell and return the address into a vlookup formula. Use the locals window to inspect the late binded objects. Set WordDoc = (".\TestReadWordDoc.docx")įrom there you can go on. Set WordApp = CreateObject("Word.Application") The correct code see below: Option Explicit
![conflence import word document headings conflence import word document headings](https://www.duxburysystems.com/documentation/dbt$11.2/Resources/Images/working_with_word/word_styles_and_formating_dialog.jpg)
You don't need the application object to create your word app. I'm sorry there was a big mistake in my first answer.
![conflence import word document headings conflence import word document headings](https://cdlgrads.com/pictures/0af202df743e9cc55a24ec43a8b892d7.png)
Then you have to loop over the paragraphs importing the text to your excel spreadsheet or iterate through all of the file text and then catch the patterns you search for. Content property you have access to all of the text in the file. So in case you can see the other members of the document obejct here: įor example with the. myParagraphs = myWordDoc.listParagraphsĪs described in the ms office dev center: ĭon't know if this is exactly what you need. Now you can access a list of numbered paragraphs in the document obejct. Set myWordDoc = myWordApp.open "your file path goes here" Set myWordApp = Application.CreateObejct("Word.Application") You can create a WordApplicaiton object and then open your desired document. Assuming yout are using the excel vba editor.