我发现了一件有趣的事情:
在word 2010中,选择一些文本,然后运行以下VBA代码:
public Sub Test()
With Selection.Range.Find
MsgBox .Execute(Selection.Range.text)
MsgBox .Found
End With
End Sub
两个消息框都显示“False”,但都应为“True”。为什么?
我发现了一件有趣的事情:
在word 2010中,选择一些文本,然后运行以下VBA代码:
public Sub Test()
With Selection.Range.Find
MsgBox .Execute(Selection.Range.text)
MsgBox .Found
End With
End Sub
两个消息框都显示“False”,但都应为“True”。为什么?
非常有趣
Word 2007也表现出同样的行为。
The curious thing is that this not only when you are searching from VBA: If you select some text in the doc and press "find", the find dialog displays as default the selected text as objective.
By pressing "Find Next >" Word displays an error message "Word has reached the end of the document ... etc".
如果修改文本以搜索删除最后一个字符,则不会发生这种情况。VBA与之一致:以下代码有效!
Sub tt()
With Selection.Range.Find
MsgBox .Execute(Mid(Selection.Range.Text,1,Len(Selection.Range.Text)-1))
MsgBox .Found
End With
End Sub
未解决。。。但是被证明与GUI一致。
啊!
In C#, I know that I can overload the constructor for a class by specifying it in the body of the class: public class MyClass() { public MyClass(String s) { ... } } This overrides the default ...
I have an Access app where I use search functionality. I have a TextBox and a Search Button on the form, and it does a wildcard search of whatever the user enters in the TextBox, and displays the ...
I recently switched to Outlook 2007 and noticed that my VBA-macros won t work. I use the following code to open a new appointment-item (and fill it automatically). It worked perfect in Outlook 2003, ...
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 ...
I m using Application run to call several macros in order like this. Sub Run_All_Macros() Application.Run ("Macro_1") Application.Run ("Macro_1") End Sub When I start Run_All_Macros, all the ...
I m using Microsoft Office 2003 and creating a bunch of template documents to standardize some tasks. I asked this on Superuser.com and got no response so I m thinking it s too program-y and hoping I ...
I have to deal with a few macros (not VBA) in an inherited Access application. In order to document them, I would like to print or list the actions in those macros, but I am very dissatisfied by ...
I need to ensure a Macro which works on Visio 2003 doesn t cause problems on lower versions of Visio: specifically because I m writing to a property which doesn t exist on lower versions of Visio. ...