word-2010

test for error returned by TOC field code

喜夏-厌秋 提交于 2021-01-28 08:00:54
问题 I am trying to test whether any "figure captions" exist before I create a Table of Figures. I have a line of code that works: {IF {TOC \h \z \c "Figure"} = {TOC \h \z \c "blarghel"} " No table" "Entries exist"} (field codes, of course), where "blarghel" is a deliberate dummy. I thought I used to be able (in Word 2003) to quote the error string returned, which for WORD 2010 would be {IF {TOC \h \z \c "Figure"} = "No table of figures entries found." " No table" "Entries exist"} But that always

VBA find word and replace with a Hyperlink in Word 2010

本秂侑毒 提交于 2020-08-02 04:59:14
问题 I've a word document with some text. At some paragraphs I've words that I want to add the hyperlink to. Here's an example: The book "When the sun goes up", ABC-1212321-DEF, have been released today....... The "ABC-1212321-DEF" should be found and apply a hyperlink as follows: http://google.com/ABC-sometext-1212321-anothertext-DEF All the strings in the document starts with "ABC-" and ends with "-DEF". Thanks in advanced. EDIT: This is what I've got this far: Sub InsertLinks() Dim r As Range

MS Word VBA: I need a color palette dialog box

≡放荡痞女 提交于 2020-06-23 03:36:45
问题 In VBA for MS Word 2010, how can I get Word to bring up a color palette dialog box so the user can pick a color? There are tons of examples on how to do it in Excel, but I haven't found any help for Word users. Here's the code for Excel: Application.Dialogs(xlDialogPatterns).Show Problem is, there's no wdDialogPatterns equivalent, nor can I find anything with a name that suggests a color palette dialog. I've found wdFormatBordersAndShading, but it's not quite the same: I want the user to

MS Word VBA: I need a color palette dialog box

时间秒杀一切 提交于 2020-06-23 03:36:08
问题 In VBA for MS Word 2010, how can I get Word to bring up a color palette dialog box so the user can pick a color? There are tons of examples on how to do it in Excel, but I haven't found any help for Word users. Here's the code for Excel: Application.Dialogs(xlDialogPatterns).Show Problem is, there's no wdDialogPatterns equivalent, nor can I find anything with a name that suggests a color palette dialog. I've found wdFormatBordersAndShading, but it's not quite the same: I want the user to

How do you correctly set document properties using VBA?

瘦欲@ 提交于 2020-01-24 02:16:21
问题 The problem I'm having some trouble setting document properties using VBA in Word 2010. I have a document containing several Heading 1 sections and I use a macro to extract a selected section (along with it's contents) and paste it to a new document. This part works fine, but at the end I need to set several document properties, but none of them are being set. I'm trying to set both built-in and custom properties, but for the purpose of this question I'd like to set title , subject and,

Copy shape in Word 2010 without .Select?

给你一囗甜甜゛ 提交于 2020-01-23 10:55:12
问题 Is it possible to copy a shape in Word 2010 without resorting to .Select ? According to Dev Center the Anchor property returns the shape's anchoring range. Could that be a way forward? However, the code below returns an error. Sub createShape() Set myShape = ActiveDocument.Shapes.AddShape(msoShapeRectangle, 1, 1, 1, 1) myShape.Anchor.Copy End Sub 回答1: While it does not seem to be possible to copy a shape without selecting it, it is possible to duplicate a shape without selecting it (which was

How to run a VBA Macro by clicking Word 2010 Checkbox?

送分小仙女□ 提交于 2020-01-14 09:17:28
问题 I want to run a macro when I click a checkbox in Word 2010 . Note that I neither want the "Legacy Forms" checkbox nor the "ActiveX" ones! They do only work in some "protected document mode" and look ugly, but I want the new ones which can be selected and unselected just when you write the document, and which look much nicer to me. I know, with the legacy forms, you can directly insert a Macro when entering the form element and one for leaving it, and you can catch the event in VBA like Sub

How to run a VBA Macro by clicking Word 2010 Checkbox?

╄→гoц情女王★ 提交于 2020-01-14 09:17:09
问题 I want to run a macro when I click a checkbox in Word 2010 . Note that I neither want the "Legacy Forms" checkbox nor the "ActiveX" ones! They do only work in some "protected document mode" and look ugly, but I want the new ones which can be selected and unselected just when you write the document, and which look much nicer to me. I know, with the legacy forms, you can directly insert a Macro when entering the form element and one for leaving it, and you can catch the event in VBA like Sub

How to export or create MATHML from MS word 2010?

浪尽此生 提交于 2020-01-05 12:26:46
问题 I have mathematical expressions in word document. Is it possible to export data as MATHML format? For example below formula existed in a word as a mathematical expression. Above expression should represent as below MATHML code. <math xmlns="http://www.w3.org/1998/Math/MathML" display="block"> <mrow> <mi>x</mi> <mo>=</mo> <mfrac> <mrow> <mo>−</mo> <mi>b</mi> <mo>±</mo> <msqrt> <mrow> <msup> <mi>b</mi> <mn>2</mn> </msup> <mo>−</mo> <mn>4</mn> <mi>a</mi> <mi>c</mi> </mrow> </msqrt> </mrow> <mrow

How to export or create MATHML from MS word 2010?

拟墨画扇 提交于 2020-01-05 12:24:08
问题 I have mathematical expressions in word document. Is it possible to export data as MATHML format? For example below formula existed in a word as a mathematical expression. Above expression should represent as below MATHML code. <math xmlns="http://www.w3.org/1998/Math/MathML" display="block"> <mrow> <mi>x</mi> <mo>=</mo> <mfrac> <mrow> <mo>−</mo> <mi>b</mi> <mo>±</mo> <msqrt> <mrow> <msup> <mi>b</mi> <mn>2</mn> </msup> <mo>−</mo> <mn>4</mn> <mi>a</mi> <mi>c</mi> </mrow> </msqrt> </mrow> <mrow