ms-word

How to add a text in existing .docx file on desired location

南楼画角 提交于 2020-01-06 14:03:36
问题 I want to open an existing .docx file and insert some text in second paragraph. Private Sub insertText() Dim WordApp As New Microsoft.Office.Interop.Word.Application Dim aDoc As Microsoft.Office.Interop.Word.Document = WordApp.Documents.Open("C:\File1.docx") Dim RNG As Microsoft.Office.Interop.Word.Range() end sub Now what should I write to insert some text in second para ?? Any help will be greatly appreciated. Thanks in advance. 回答1: You can use Application.Selection.TypeText() for that:

Copy unformatted plain text to the clipboard using VBScript

社会主义新天地 提交于 2020-01-06 12:43:42
问题 I'm using the following function in my VBScript to copy a string onto the clipboard without the use of the external clip command (which isn't and cannot be installed due to security policies): Function CopyToClipboard(sText) Dim oWord : Set oWord = CreateObject("Word.Application") With oWord .Visible = False .Documents.Add .Selection.TypeText sText .Selection.WholeStory .Selection.Copy .Quit False End With Set oWord = Nothing End Function The problem is that the string being copied comes with

Copy unformatted plain text to the clipboard using VBScript

一个人想着一个人 提交于 2020-01-06 12:43:11
问题 I'm using the following function in my VBScript to copy a string onto the clipboard without the use of the external clip command (which isn't and cannot be installed due to security policies): Function CopyToClipboard(sText) Dim oWord : Set oWord = CreateObject("Word.Application") With oWord .Visible = False .Documents.Add .Selection.TypeText sText .Selection.WholeStory .Selection.Copy .Quit False End With Set oWord = Nothing End Function The problem is that the string being copied comes with

VBA Word: Change Data of charts

余生颓废 提交于 2020-01-06 09:04:33
问题 I want to change the data of a chart in a Word Document, but I can't find the right way to address my charts. I tried several techniques, but nothing worked. (I´d love to open a ExcelSheet in which I can just change the Data) So to put it all together: I want to change the data (not the source), of a MS Word chart, which looks like that: Edit(13.8.): After request, I try to give you some "reference Code" to work with. Sub ChangeChart() Dim aktDocument As Document Dim chrt As Chart Dim

figure and figcaption not converting correctly to Word images with captions

为君一笑 提交于 2020-01-06 08:42:20
问题 I have HTML5 source code (with full doctype/head/body) that needs to be converted to a Word DOCX file. The HTML file is generated page with minimal formatting ( H1/H2/P ) and images ( img ). There is a FIGURE that contains the image source ( SRC ) parameter, and then there is a FIGCAPTION tag that contains the caption for the image, similar to this (from https://www.w3schools.com/tags/tag_figcaption.asp ): <figure> <img src="img_pulpit.jpg" alt="The Pulpit Rock" width="304" height="228">

Word Macro: Change page orientation depending on image ratio

你离开我真会死。 提交于 2020-01-06 08:02:09
问题 My macro currently does the following: It adds a header to a Word document, then reads image files from a specific folder from the HDD and adds them to the same document with the name of the file below the image and a page break after each image. To ensure that the name doesn't get pushed to the next page (if the image fills the whole page), I set the bottom margin to a higher value before adding the image and the name and then set the margin back to the original value. This way the image is

Getting a second login prompt when attempting to open a link to a word doc

和自甴很熟 提交于 2020-01-06 07:56:31
问题 I have created a simple website, that lists word documents stored on our server. Our site is using basic authentication with SSL certificate. So when the user first goes to the site, they are prompted for a username and password, once they log in and when a user clicks on a link and clicks "open" to open the word doc (.doc or .docx) he's prompted to login again. Clicking "Cancel" two times, and the prompt goes away, and the document opens. How can i remove this second login request? I've

Getting a second login prompt when attempting to open a link to a word doc

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-06 07:56:12
问题 I have created a simple website, that lists word documents stored on our server. Our site is using basic authentication with SSL certificate. So when the user first goes to the site, they are prompted for a username and password, once they log in and when a user clicks on a link and clicks "open" to open the word doc (.doc or .docx) he's prompted to login again. Clicking "Cancel" two times, and the prompt goes away, and the document opens. How can i remove this second login request? I've

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

vba When inserting file, margins in new section disappearing

时光毁灭记忆、已成空白 提交于 2020-01-06 07:04:21
问题 I want to insert DocB' into DocA using the VBA code: Selection.InsertFile DocB. DocA is a normal document in every regard. DocB has 2 sections. The first is 'normal' stuff. The second section (properly marked with a Section Break/Next Page) has a new set of left and right margins. When DocB is inserted into DocA with the above VBA command, all formatting (fonts, spacing, etc.) EXCEPT that the margins in the second section of DocB don't carry into DocA. (The Section Break/New Page marker is