English 中文(简体)
如何提及Excel VBA中文本表格的内在缺陷价值
原标题:How to refer to the in-built Default value for a text FormField in Excel VBA

我正试图在Excel撰写一些法典,这些法典通过一些文件并从表格领域提取细节。 这些文件都是用同一模板制作的,用户只能将细节输入既定领域(文件的其他内容都锁定)。

某些形式领域是任择性的,因此留下空白。 但是,该法典将“和投入”的价值推向了囚室,然后在法典中引起问题。 我想把价值储存在“”。

[我正在使用Excel 2010]

我已尝试如下:

If ActiveDocument.FormFields(1).Range.Text = vbNull Then

If ActiveDocument.FormFields(1).Range.Text = "" Then

If ActiveDocument.FormFields(1).Range.Text = "     " Then

以及

If ActiveDocument.FormFields(1).TextInput.Default = True Then

他们似乎都没有工作。

任何人都知道如何在表格现场提及失法行为的价值?

问题回答
  • If the default value was NOT altered during the insertion of a form field, you can identify its default value using the Result property.

“entergraph

Option Explicit
Sub demo()
    Dim FF As FormField
    For Each FF In ActiveDocument.FormFields
        If Len(FF.Result) = 0 Then
            Debug.Print "Default value is in " & FF.Name
        Else
            Debug.Print "Users input is in " & FF.Name
        End If
    Next
End Sub

Microsoft documentation:





相关问题
import of excel in SQL imports NULL lines

I have a stored procedure that imports differently formatted workbooks into a database table, does work on them then drops the table. Here is the populating query. SELECT IDENTITY(INT,1,1) AS ID ...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

Excel date to Unix timestamp

Does anyone know how to convert an Excel date to a correct Unix timestamp?

C# GemBox Excel Import Error

I am trying to import an excel file into a data table using GemBox and I keep getting this error: Invalid data value when extracting to DataTable at SourceRowIndex: 1, and SourceColumnIndex: 1. As ...

Importing from excel "applications" using SSIS

I am looking for any tips or resources on importing from excel into a SQL database, but specifically when the information is NOT in column and row format. I am currently doing some pre-development ...

热门标签