word-table

Getting an error trying to insert field in a Word table cell

蓝咒 提交于 2020-03-24 00:16:39
问题 I create a formfield (textinput), and when I go to name it I get: 91 Object variable or With block variable not set There are dozens of other places in this macro where I do the same exact thing and it works fine. Here is the code: Private Sub IRPMs() Dim objCon As New ADODB.Connection Dim rs As New ADODB.Recordset Dim i, j, k As Integer Dim tmpField As FormField Dim strOut As String Set doc = ActiveDocument i = 0 j = 1 k = 0 Call grabInfo strFieldName(1) = "Property: " strFieldName(2) =

How I can export from a DataTable to a Content control in C# using Openxml?

流过昼夜 提交于 2020-01-30 11:49:54
问题 So I have this code, but i want to know how possible it is to convert from a result gotten from an SQL DataTable to print on a Microsoft word content control My code looks something like this public bool PrintTableonContentControl(string connectionString, string DbQuery,string filePath, string placeholderText) { try{ DataTable dt = new DataTable(); using(SqlConnection con = new SqlConnection(connectionString)){ con.Open(); using(SqlCommand cmd = new SqlCommand(DbQuery,con)){ using

Reading date from table in Word without additional characters

别等时光非礼了梦想. 提交于 2019-12-02 16:58:49
问题 so I started with VBA yesterday and keep running into walls. In the long run, I'm trying to create a Word template that checks if it's still up to date or if it's time for revision. Right now I want to store a date from the document in a variable. I couldn't find a method to directly read out something in date format so now I'm using Selection.Text and CDate but that gives me an error (incompatible types) because my selection seems to contain another character or marker ([]). I'm guessing it

Reading date from table in Word without additional characters

我只是一个虾纸丫 提交于 2019-12-02 10:40:15
so I started with VBA yesterday and keep running into walls. In the long run, I'm trying to create a Word template that checks if it's still up to date or if it's time for revision. Right now I want to store a date from the document in a variable. I couldn't find a method to directly read out something in date format so now I'm using Selection.Text and CDate but that gives me an error (incompatible types) because my selection seems to contain another character or marker ([]). I'm guessing it has something to do with the fact that the bookmark is on a cell of a table within my Word document

VBA - How to start a selection halfway through the text in a table

拈花ヽ惹草 提交于 2019-11-28 02:26:00
As an alternative to my previous question regarding range.find , I am trying Selection.find . I have found the occurrence of an abbreviation inside a table. I want to continue my search from the location of that result. However, when I get the range and select it, the Selection starts from the beginning of the row. How can I restrict it to be from the previous occurrence? current code: Private Sub cmdFindNextAbbr_Click() Dim myRange As range Dim Word, findText As String Dim chkAbbrLast, chkAbbrFullLast, fsCountExt, NextAbbrStart, NextAbbrStartTemp, NextAbbrEndTemp As Integer Dim firstOccEnd As

VBA - How to start a selection halfway through the text in a table

爱⌒轻易说出口 提交于 2019-11-26 23:43:04
问题 As an alternative to my previous question regarding range.find , I am trying Selection.find . I have found the occurrence of an abbreviation inside a table. I want to continue my search from the location of that result. However, when I get the range and select it, the Selection starts from the beginning of the row. How can I restrict it to be from the previous occurrence? current code: Private Sub cmdFindNextAbbr_Click() Dim myRange As range Dim Word, findText As String Dim chkAbbrLast,