Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLE automation question

Status
Not open for further replies.

daimaou

Programmer
Apr 4, 2001
154
PT
Hi. I'm trying to develop an application based on lots of OLE automation, mainly generating documents on a OLE object and then saving them to a .doc format. ie first I generate the document on a OLE object, let the user edit something if he wants and then save it to a .doc file.
Anyway I've noted that some commands aren't available for the OLE object edition. In my case I need to add some footnotes on my document, but this isn't accessible on a OLE object. Is there any way to have access to this functions on a OLE object or are they only available to me if I open word with createobject("Word.Application")?

Any help is appreciated.
 
integer result

result = o1.ConnectToNewObject("word.application.9")
IF result <> 0 THEN
DESTROY o1
MessageBox(&quot;OLE Error&quot;, &
&quot;Unable to connect to Microsoft Word. &quot; &
+ &quot;Code: &quot; &
+ String(result))
DESTROY o1
RETURN
END IF


ole_1.Activate(OffSite!)
ChangeDirectory( &quot;c:\cenk&quot; )
integer li_res
is_cenk =sle_1.text

if is_cenk=&quot;&quot; then
messagebox(&quot;dikkat&quot;,&quot;Herhangi bir document adý girmediniz&quot;)
return 0
elseif FileExists(is_cenk) = false then

li_res =messagebox(&quot;hata&quot;,&quot;var olmayan document girildi!Yaratmak istermisin?&quot;,Question!,YesNo!,1)
if li_res = 1 then
o1.Application.Run(&quot;FileNew&quot;)
o1.Application.Visible = true
else
return 0
end if
else

is_doc =is_cenk+&quot;.doc&quot;
is_cenk =&quot;c:\cenk\&quot;+is_cenk+&quot;.doc&quot;
messagebox(&quot;Seçilen Dizin&quot;,is_cenk)
o1.Application.Visible = true
o1.Documents.Open(is_cenk)

end if

***** i wanna do the same things but my problem is, i cant save changes if i try 2 open the ole document in the OLE object!the code above works just like word itself NOT in an OLE control.DO you get solutions 2 your problem?i would be grateful if you can help me.thanks
 
You need to Open the Ole and not Edit it (right mouse click on the container and then you should see the choices to Edit or Open). If you select Open, then Word will start and then you can add the footnotes. Do not ask me why this is so....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top