oleobject问题
我使用ole连接word时,报这个错(Error:Error calling external object function saveas at line ## in clicked event of object cb_# of w_main)
我使用的代码如下:
OLEObject o1
string s1
o1 = CREATE oleobject
o1.ConnectToNewObject("word.application")
o1.documents.open("c:\temp\temp.doc")//////在这条语句上报错!!!!!!!!!!!!
// Make the object visible and display the
// MS Word user name and filename
o1.Application.Visible = True
s1 = o1.UserName
MessageBox("MS Word User Name", s1)
s1 = o1.ActiveDocument.Name
MessageBox("MS Word Document Name", s1)
//Insert some text in a new paragraph
o1.Selection.TypeParagraph()
o1.Selection.typetext("Insert this text")
o1.Selection.TypeParagraph()
// Insert text at the first bookmark
o1.ActiveDocument.Bookmarks[1].Select
o1.Selection.typetext("Hail!")
// Insert text at the bookmark named End
o1.ActiveDocument.Bookmarks.item("End").Select
o1.Selection.typetext("Farewell!")
// Save the document and shut down the server
o1.ActiveDocument.Save()
o1.quit()
RETURN