问题描述
我找到了一些示例代码,可以将一些文本放入Word中。我正在测试这个
代码以便从中学习,但我在下面的代码中找不到使用CType
的解释。有人可以解释使用CType吗?
app = CType(GetObject(Nothing,Word.Application),Word.Application)
app。 Selection.Text ="这是文字。
也是:
app = GetObject(Nothing," Word) .Application")
app.Selection.Text ="这是文字。
两者都有效。
问候,
Marcel
Hi,
I''ve found some sample code to put some text into Word. I''m testing this
code to learn from it, but I can''t find an explanation for the use of CType
in the following code. Can someone explain the use of CType?
app = CType(GetObject(Nothing, "Word.Application"), Word.Application)
app.Selection.Text = "Hi, this is text."
Also does:
app = GetObject(Nothing, "Word.Application")
app.Selection.Text = "Hi, this is text."
Both do work.
Regards,
Marcel
这篇关于CType()有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!