Dim Word As Word.Application Dim Doc As Word.Document
在工具菜单下的引用里选上microsoft word对象库
你把Dim Doc As New Document 修改为Dim Doc As object然后在 Private Sub Command1_Click() Form1.Caption = "拼写检查" 这个之后加入 Set Doc = CreateObject("word.document") 这条语句就可以了
Dim Word As Word.Application Dim Doc As Word.Document
哪有定义时就new 的. dim word as word.application set word=new word.application
Dim Doc As Word.Document
修改为Dim Doc As object然后在
Private Sub Command1_Click()
Form1.Caption = "拼写检查"
这个之后加入
Set Doc = CreateObject("word.document")
这条语句就可以了
Dim Doc As Word.Document
dim word as word.application
set word=new word.application
CheckSpelling([CustomDictionary], [IgnoreUppercase], [AlwaysSuggest], [CustomDictionary2], [CustomDictionary3], [CustomDictionary4], [CustomDictionary5], [CustomDictionary6], [CustomDictionary7], [CustomDictionary8], [CustomDictionary9], [CustomDictionary10])
或先定义字典:
GetSpellingSuggestions([CustomDictionary], [IgnoreUppercase], [MainDictionary], [SuggestionMode], [CustomDictionary2], [CustomDictionary3], [CustomDictionary4], [CustomDictionary5], [CustomDictionary6], [CustomDictionary7], [CustomDictionary8], [CustomDictionary9], [CustomDictionary10])
你的代码是不是只截了一些过来.