Hello
I am using COM object (Word) in my application, and I have two problems:
1) I open new instance of Word, with empty, new document. I hendle the
event DocumentBeforeSave. I would like to do something like this on this
event:
-save active document, but without showing the Save As dialog (I can save
it using some generated filename) : I tried calling ActiveDocument.SaveAs
method, giving the filename, but it still shows the Save As dialog
-do something using the saved document
-end the event handling method and close word (or at least do something, so
that the next Save as dialog does not show up) - I tried setting SaveAsUI
to false, and Cancel to true, it doesn't help
2) I would like to refresh the form of a application after saving the
document, It doesn't work now, there's an exception on OnPaint event. I
know that Word is opened in new thread, maybe that's why I cant refresh
component on main form when handling BeforeSabe event
Can anyone help?
I work on Visual Studio 2005.
I'm sorry if this is simple question, I tried googling it, but i didn't
find anything usefull
Omega
Jigar Mehta - 24 Nov 2006 13:28 GMT
Hello,
I dont think this is right group for this question.
Interop means, if you are using some COM component from .NET - managed world,
you can post your question here. I think you should go to MS Office API newsgroup
for this issue.
=============
Regards,
Jigar Mehta
> Hello
>
[quoted text clipped - 26 lines]
>
> Omega
RobinS - 24 Nov 2006 16:59 GMT
Try the microsoft.public.vb.ole.automation group.
Robin S.
---------------------------
> Hello,
>
[quoted text clipped - 38 lines]
>>
>> Omega
Kodali Ranganadh - 25 Nov 2006 08:21 GMT
Hi, Omega
U can save the document with out open the save dialog box, in any of
the office automation applications, By simple calling the
this.ApplicationInstance.WordAppl.DisplayAlerts
=Microsoft.Office.Interop.Word.WdAlertLevel.wdAlertsNone;
Object xml = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatXML;
applicationinstance.ActiveDocument.SaveAs(ref TemoFileName, ref xml,
ref Missing, ref Missing, ref Missing, ref Missing, ref Missing, ref
Missing, ref Missing, ref Missing, ref Missing, ref Missing, ref
Missing, ref Missing, ref Missing, ref Missing);
like that, Hear
and also same way u can open the empty document in any kind of
situation, Bys simple creating the instance like
Microsoft.Office.Interop.Word.Application app = new
Microsoft.Office.Interop.Word.ApplicationClass();
app.open();
like that.
> Hello
>
[quoted text clipped - 22 lines]
>
> Omega