本文介绍了CType()有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我找到了一些示例代码,可以将一些文本放入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()有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-25 13:36