Hi everybody,
I have a Word document in a WebBrowser. I modify the doc and save it with another name in another path. Finally I close my form and put my doc as nothing. My problem is that a dialog box appears sugesting me saving the changes (the changes done in the initial path) but i have already saved my document so I always want to select "No", how can I avoid this dialog box? Or if it isn't possible, how can I automatize this action?
(The dialog box appears by defect)
Thanks a lot and sorry for my english, it isn't my mother tongue.
7 15650
A Word document in a WebBrowser?
Where is the word document supposed to save to??
I've the word document (only read) saved in MyDocuments and show it in a WebBrowser control. After modify it I save it as another one in another path...
Do u need more information?
Thanks!
ok,
since you are using vb.net, you can, of course open a word document, using activeX: - dim Obj1 as object
-
Obj1 = createobject("word.application")
-
obj1.open("yourfile.doc")
-
obj1.activedocument.saveas("OtherName.doc")
-
obj1.visible=true
This will open a word instance, showing the document. Still, the word instance will be shown to the user, but the document will be opened from the server, and saved in the server (for what you might need some privileges). I dont remember, but my guess is that you can embed this 'Obj1' to some kind of OLE control in your webform.
HTH
Thank u kadghar, but OLE container control is not available for WinForms in VB 2005, this is the cause to use a WebBrowser... Besides I get my document, the problem is in the final dialog box remembering me to save when I have saved before...
oh, that's easy, you can use the same code above. Just change the DisplayAlerts property to false:
Obj1.DisplayAlerts = False
HTH
I have tried to apply this code in my project without success.
Here is my code: -
Dim WordApp As New MSWord.Application
-
Dim doc As MSWord.Document
-
Dim docobj As Object
-
-
Private Sub Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
Dim document As System.Windows.Forms.HtmlDocument
-
Dim strFileName As String = ("c:\myword.doc")
-
WebBrowser1.Navigate(strFileName)
-
document = WebBrowser1.Document
-
WordApplication.DisplayAlerts = Microsoft.Office.Interop.Word.WdAlertLevel.wdAlertsNone
-
End Sub
-
-
-
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
-
docobj = Me.WebBrowser1.ActiveXInstance.document
-
If TypeOf (docobj) Is MSWord.Document Then
-
doc = docobj
-
doc.SaveAs("c:\anotherword.doc")
-
End If
-
End Sub
-
-
Public Sub Close_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_Volver.Click
-
WebBrowser1.Navigate("about:blank")
-
doc=nothing
-
docobj=nothing
-
WordApp.Quit()
-
WodApp=Nothing
-
End Sub
-
After the form is closed appears the dialog as always... I don't know if it's necessary to definy WordApp but I tried it to use DisplayAlerts.
I hope u will can help me... Thank u very much for your time and your interest.
yes,
the only way to disable alerts, its with the application. This will do:
WordApp.DisplayAlerts = False
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Gary |
last post by:
Hi, there,
1. I would like to open a word document in a MDI environment. Every time, a new window outside my MDI poped out and show the word document. Is there a method I can use to specify the...
|
by: a94ws7 |
last post by:
I am trying to automate a digital signature process with Microsoft Word, I
have experimented by loading the word document into word and then from there
placing that document inside a picturebox so...
|
by: John Smith |
last post by:
Hey folks,
I've got a Windows C# application that generates a .doc file and then allows
the user to preview it.
I generate the file using the StreamWriter class and do a flush() and a
close()...
|
by: JerryShea |
last post by:
Hi,
I am opening a word document (RTF) in a webbrowser control and automating
it. Most automation features seem to work but when I execute:
wordApp.ActiveDocument.PrintPreview()
I get an...
|
by: peshekeedweller |
last post by:
In VB.net, how can I use automation to open a word document in a word window
as a child window of an MDI form? Thanks in advance.
|
by: lloyduh234 |
last post by:
I need to display and allow the user to print a Word document from within a
C# WinForm application. I'm using the ActiveX Browser control. The Word
document displays correctly, but remains "locked"...
|
by: Dennis |
last post by:
I would like to host a word document in a windows form. Can anyone give me
any guidance on how to do this, i.e., a control that accepts and displays a
word document?
--
Dennis in Houston
|
by: Dean Richardson |
last post by:
Hello,
I am currently building a windows application in VB.NET. At the moment
I have a word document saved locally which I open with the WebBrowser
control.
I cannot seem to save the changes...
|
by: Dean Richardson |
last post by:
Hello,
I am currently building a windows application in VB.NET. At the moment
I have a word document saved locally which I open with the WebBrowser
control.
I cannot seem to save the...
|
by: =?Utf-8?B?SWdvcg==?= |
last post by:
Hi !
I have a problem with WebControl
I opened Microsoft Word document not directly, but in Visual Basic 6.0
WebBrowser control.
When I selected with Range.Select any text the Saved property...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |