ms-word

Is it possible to refresh fields of a word document with Office.js?

橙三吉。 提交于 2021-02-11 06:11:25
问题 I have word documents with fields that display the value of custom document properties as such: `{ DOCPROPERTY example \* MERGEFORMAT }` Whenever my custom property is modified, in order for the changes to be displayed in my document, I need to select the field(s) and right-click -> update them. I was wondering if office.js had anything that would help me automatically update fields in my document. 回答1: There is no API to do this currently. But it is an excellent idea. Please suggest it at

Is it possible to refresh fields of a word document with Office.js?

百般思念 提交于 2021-02-11 06:09:48
问题 I have word documents with fields that display the value of custom document properties as such: `{ DOCPROPERTY example \* MERGEFORMAT }` Whenever my custom property is modified, in order for the changes to be displayed in my document, I need to select the field(s) and right-click -> update them. I was wondering if office.js had anything that would help me automatically update fields in my document. 回答1: There is no API to do this currently. But it is an excellent idea. Please suggest it at

Create table in Word Document From Access using VBA

泪湿孤枕 提交于 2021-02-11 03:35:34
问题 I am trying to create tables in a Word document template from my Access database. This bit of code runs fine from Word itself and creates tables as required. I was wondering if its possible to run this code from Access and point to a specific word document in which to create the tables. Dim numberOfTables As Integer Dim iCount As Integer numberOfTables = InputBox("How many tables to make?", "Tables") For iCount = 0 To numberOfTables - 1 ActiveDocument.Tables.Add Range:=Selection.Range,

Word Macro Remove Rows from Table If Cell Empty

血红的双手。 提交于 2021-02-10 20:38:37
问题 I am trying to run a Macro that will check a selected table for empty cells in column 2, and if there are empty cells, delete that row. Sub DeleteEmptyRows() Set Tbl = Selected.Tables(1) With Tbl noOfCol = Tbl.Range.Rows(1).Cells.Count With .Range For i = .Cells.Count To 1 Step -1 On Error Resume Next If Len(.Cells(i).Range) = 2 Then .Rows(.Cells(i).RowIndex).Delete j = i Mod noOfCol If j = 0 Then j = noOfCol End If Next i End With End With End Sub And it's really close to what I want, but I

How can I disable Word's built-in Ribbon Tabs when a specific document is loaded?

独自空忆成欢 提交于 2021-02-10 20:20:30
问题 I am using the following code right now: <?xml version="1.0" encoding="UTF-8"?> <customUI onLoad="Ribbon_Load" xmlns="http://schemas.microsoft.com/office/2006/01/customui"> <commands> <command idMso="Font" enabled="false"/> <command idMso="AlignLeft" enabled="false"/> <command idMso="AlignCenter" enabled="false"/> <command idMso="AlignRight" enabled="false"/> </commands> and so on, but this completely disables the buttons obviously. I now want to restrict my users from being able to use

Add hyperlink into Word Content Control with VBA

纵饮孤独 提交于 2021-02-10 19:43:34
问题 I have a Word 2010 template. When used, a form is presented to the user and they are prompted to enter a string in a textbox named BugNumTextBox . Upon command, I wish to construct a URL, create a hyperlink, and insert that into the document. The desired insertion point (anchor) is a Rich Text Content Control with a tag name of "foo". For the address parameter I have attempted: 1) To specify the range of the content control 2) To specify the range of a bookmark (named BugNum) that I created

How to make Microsoft Word visible after opening an Excel file in Word VBA

风流意气都作罢 提交于 2021-02-10 19:34:08
问题 I have a VBA Word macro that opens a Word doc, then opens an Excel file, selects a cell reference and finally displays a message using Msgbox. After the Excel file has been opened I am having trouble finding the code to make Word visible so that the user can view the Msgbox message without having to using the task bar to switch from Excel to Word. I tried oWord.Visible = True but VBA gives me an error. Any hints are appreciated. See the code below: Sub Module_Test() Dim oExcel As Object Dim

How to make Microsoft Word visible after opening an Excel file in Word VBA

偶尔善良 提交于 2021-02-10 19:32:43
问题 I have a VBA Word macro that opens a Word doc, then opens an Excel file, selects a cell reference and finally displays a message using Msgbox. After the Excel file has been opened I am having trouble finding the code to make Word visible so that the user can view the Msgbox message without having to using the task bar to switch from Excel to Word. I tried oWord.Visible = True but VBA gives me an error. Any hints are appreciated. See the code below: Sub Module_Test() Dim oExcel As Object Dim

Copying Data From Word Document Using Excel VBA

白昼怎懂夜的黑 提交于 2021-02-10 18:40:59
问题 I have an excel file that that has a filename of a word document. I want to use excel vba to open the word document, then search for a specific phrase, copy the characters following that phrase, and paste it back into the original excel file. I have attempted several ways to implement this design, with little success. Below is my most recent attempt. My main issue is that the program usually just stops when it hits my with statement. Why does that happen, and how do I fix things so that the

Word VBA: find line and replace font

半城伤御伤魂 提交于 2021-02-10 14:24:34
问题 I've written a VBA Word Macro that read a .txt File, copy it and paste it in a Word document setting a new font. All is working fine! Now I would like to highlight some specific lines with bold + italic font, but i cannot figure out a working solution. The specific lines begins with a specific word (for example Simulation Nr.xxx ) or they begin with some words but then they have a very long series of blank spaces (for example Turbine ). How can i solve the problem? P.s.: here the working code