首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

VBA-VB 为什么运行后,指“Content”未找到方法或数据成员,多谢

2012-09-11 
VBA-VB 为什么运行后,指“Content”未找到方法或数据成员,谢谢Option ExplicitPrivate Sub Command1_Click()

VBA-VB 为什么运行后,指“Content”未找到方法或数据成员,谢谢
Option Explicit

Private Sub Command1_Click()
Dim oApp As Word.Application
Dim oDoc As Word.Document
Set oApp = New Word.Application
oApp.Visible = True
Set oDoc = oApp.Documents.Add

oApp.Content.Font.Name = "宋体"
oApp.Content.Font.Size = 16
oApp.Content.Paragraphs.LineSpacing = 3
oApp.Paragraphs(oApp.Paragraphs.Count).Alignment = wdAlignParagraphCenter
oApp.Paragraphs(oApp.Paragraphs.Count).Range.Font.Bold = True

oApp.ActiveWindow.Selection.TypeText "(题目)" & vbCrLf

oApp.Content.Paragraphs.LineSpacing = 3
oApp.Paragraphs(oApp.Paragraphs.Count).Alignment = wdAlignParagraphLeft
oApp.Paragraphs(oApp.Paragraphs.Count).Range.Font.Bold = False
oApp.Paragraphs(oApp.Paragraphs.Count).Range.Font.Size = 11

oDoc.SaveAs App.Path & "\(题目).doc"

oDoc.Close
oApp.Quit
Set oDoc = Nothing
Set oApp = Nothing
End Sub


[解决办法]
oApp.Content 改成 oDoc.Content

热点排行