word-vba

VBA Word add captions to images, add max height criterion

孤者浪人 提交于 2020-01-06 20:13:25
问题 I have here a nice algorithm, that adds serveral pictures to a word document and gives as caption the filename without extension, for me it is very usefull and productive, I share the code below, I recommend it for large documents/reports. I need to improve this code by giving a max height or Width to the image in the document, so it wont ocupy that much space. can anyone give a hint how to do that fast and easy? maybe with the Shaperange-object? see VBA-documentation Option Explicit Sub

VBA Word add captions to images, add max height criterion

倖福魔咒の 提交于 2020-01-06 20:13:21
问题 I have here a nice algorithm, that adds serveral pictures to a word document and gives as caption the filename without extension, for me it is very usefull and productive, I share the code below, I recommend it for large documents/reports. I need to improve this code by giving a max height or Width to the image in the document, so it wont ocupy that much space. can anyone give a hint how to do that fast and easy? maybe with the Shaperange-object? see VBA-documentation Option Explicit Sub

need to skip the line that contains the text Word Macro

旧街凉风 提交于 2020-01-06 07:20:55
问题 I have to print documents and what it requires is: Sumarry page should print on single page(always a single page actually) but the next page gets printed over it's back i.e. royalty Summary. so we added a blank page after every Summary page using Macro. If "Royalty" is ending on a Odd number(example starting at page number 2 and ending on 3 means total 3 pages), then need to add a empty page. So the next summary section will start printing on a new page not at the back of ending page. what i

Word Vba Add Row to Repeating Section Content Control

大兔子大兔子 提交于 2020-01-06 05:17:49
问题 Using Word 2016, is there a way through VBA to add a new entry to a repeating section content control? I have my repeating section content control set up, and it is the only content control in the document (there is actually no other content in the document). I want to add a new repeated row, to this content control. I have tried recording a macro to see what it spits out but nothing was recorded when I added a new row manually. Maybe at this point I should realize that I am SOL, but I was

Word Vba Add Row to Repeating Section Content Control

时间秒杀一切 提交于 2020-01-06 05:17:35
问题 Using Word 2016, is there a way through VBA to add a new entry to a repeating section content control? I have my repeating section content control set up, and it is the only content control in the document (there is actually no other content in the document). I want to add a new repeated row, to this content control. I have tried recording a macro to see what it spits out but nothing was recorded when I added a new row manually. Maybe at this point I should realize that I am SOL, but I was

Prevent Vertically Merged Cells from Breaking Across Page - Automatically

断了今生、忘了曾经 提交于 2020-01-06 02:22:33
问题 I have to create documents that have large tables of data copied into them from Excel. The tables can be hundreds of rows long and generally ~20 columns wide. Many of the columns have been merged vertically to enhance readability and group sets of data. I have been able to write a macro that will fully format the entire table, except I have not been able to figure out how to automatically prevent the Vertically Merged cells from breaking/splitting across multiple pages. To do it manually, you

Retain formatting when copying from word to outlook

爷,独闯天下 提交于 2020-01-05 17:49:10
问题 I have a code which replaces the text of certain format into a hyperlink. This code works during an incoming email. Incoming email -> copy the email to word editor(formatting lost) -> make necessary changes -> copy from word editor to outlook mail item(again replaced hyperlinks gets lost in mail item) My code is here for your refernce.. Sub IncomingHyperlink(MyMail As MailItem) Dim strID As String Dim Body As String Dim objMail As Outlook.MailItem Dim strtemp As String Dim RegExpReplace As

How to remove the entire line of a word doc using vba

為{幸葍}努か 提交于 2020-01-05 16:25:31
问题 The following line of code will insert text into a bookmark range in a word document. objDoc.Bookmarks("DonorAddress").Range.Text = "6200 Main St." How do I remove the entire line containing the address bookmark if I don't have any address data? 回答1: By 'deleting the line' I believe you mean to 'delete paragraph'. If so you could do it in this way: '2 steps to delete- rather not recommended objDoc.Bookmarks("DonorAddress").Range.Paragraphs(1).Range.Select Selection.Delete or in one step:

How to remove the entire line of a word doc using vba

为君一笑 提交于 2020-01-05 16:25:08
问题 The following line of code will insert text into a bookmark range in a word document. objDoc.Bookmarks("DonorAddress").Range.Text = "6200 Main St." How do I remove the entire line containing the address bookmark if I don't have any address data? 回答1: By 'deleting the line' I believe you mean to 'delete paragraph'. If so you could do it in this way: '2 steps to delete- rather not recommended objDoc.Bookmarks("DonorAddress").Range.Paragraphs(1).Range.Select Selection.Delete or in one step:

programmatically inserting hidden text into a Word 2010 table

假装没事ソ 提交于 2020-01-05 12:31:06
问题 I have a Word 2010 table with existing, visible text in it. I want to use some VBA code to insert some text into each cell and then hide the new text. I know how to insert text into a cell using VBA, I just can't figure out how to leave the existing text in the cell visible and only hide the new text. I tried this, but it doesn't quite work: For Each aTable In ActiveDocument.Tables Rows = aTable.Rows.Count Cols = aTable.Columns.Count Dim rng As Range For r = 1 To Rows For c = 1 To Cols