Prev: The How To Change IP Question
Next: leistungen versicherung, test hausratversicherung 2009, vhb 92, vhb hausrat, keine hausratversicherung,
From: catharinus on 13 Feb 2010 05:47 Hello to you all I use word in a vb6 application to show a rft-file. See the code below. When I want to close the Word-dociument, Word asks me the following: "The file norma.doc already exists. Do you wnat to replace the existing file" After answeering 'No' I want to close Word itself. Then I get the following question: Changes have been made that affect the global template. Do you wnat to save those changes" Why do I get those questions and how can I prevent those questions in my vb6-application? Thanks Catharinus van der Werf csvanderwerf(a)planet.nl Set moApp = CreateObject("Word.Application") moApp.Visible = False cpTekst="Sample Text" Set MOWB = moApp.Documents.Open("Afdruk.rtf") 'Show Word if you wish moApp.Visible = True 'moApp.Activate 'moApp.Selection.TypeText cpTekst '"This is sample text" 'Save the file. If the document exists it is overwriten 'MOWB.SaveAs "Afdruk.rtf" 'MOWB.Close 'moApp.Quit Set MOWB = Nothing Set moApp = Nothing
From: MikeD on 13 Feb 2010 07:19 "catharinus" <csvanderwerf(a)planet.nl> wrote in message news:3306601e-4dce-4d32-bbc7-8b09d97e1844(a)g28g2000yqh.googlegroups.com... > Hello to you all > > I use word in a vb6 application to show a rft-file. See the code > below. When I want to close the Word-dociument, Word asks me the > following: > "The file norma.doc already exists. Do you wnat to replace the > existing file" After answeering 'No' I want to close Word itself. > Then I get the following question: Changes have been made that affect > the global template. Do you wnat to save those changes" > > Why do I get those questions and how can I prevent those questions in > my vb6-application? > Thanks > Catharinus van der Werf > csvanderwerf(a)planet.nl > > > Set moApp = CreateObject("Word.Application") > moApp.Visible = False > cpTekst="Sample Text" > Set MOWB = moApp.Documents.Open("Afdruk.rtf") > > 'Show Word if you wish > moApp.Visible = True > 'moApp.Activate > > 'moApp.Selection.TypeText cpTekst '"This is sample text" > > 'Save the file. If the document exists it is overwriten > 'MOWB.SaveAs "Afdruk.rtf" > 'MOWB.Close > 'moApp.Quit > Set MOWB = Nothing > Set moApp = Nothing I don't get either of those prompts using your code, even with the commented lines uncommented. This is with Word 2007. My best guess as to why you get them is that you have a different version of Word and the functionality is different, or, I think there could be a setting in Word to prompt to save templates. Or a third option might be that there's actually more code you're not showing us. But I have to ask: Why are you using Word for this? Drop a RichTextBox control onto a form and load the .rtf file in that. The obvious advantage is that your app will not require Word be installed. If all you're doing is showing the file, there's very little code you'd have to write, less than you've already written to use Word to do this. -- Mike
From: catharinus on 13 Feb 2010 08:28 On 13 feb, 13:19, "MikeD" <nob...(a)nowhere.edu> wrote: > "catharinus" <csvanderw...(a)planet.nl> wrote in message > > news:3306601e-4dce-4d32-bbc7-8b09d97e1844(a)g28g2000yqh.googlegroups.com... > > > > > > > Hello to you all > > > I use word in a vb6 application to show a rft-file. See the code > > below. When I want to close the Word-dociument, Word asks me the > > following: > > "The file norma.doc already exists. Do you wnat to replace the > > existing file" After answeering 'No' I want to close Word itself. > > Then I get the following question: Changes have been made that affect > > the global template. Do you wnat to save those changes" > > > Why do I get those questions and how can I prevent those questions in > > my vb6-application? > > Thanks > > Catharinus van der Werf > > csvanderw...(a)planet.nl > > > Set moApp = CreateObject("Word.Application") > > moApp.Visible = False > > cpTekst="Sample Text" > > Set MOWB = moApp.Documents.Open("Afdruk.rtf") > > > 'Show Word if you wish > > moApp.Visible = True > > 'moApp.Activate > > > 'moApp.Selection.TypeText cpTekst '"This is sample text" > > > 'Save the file. If the document exists it is overwriten > > 'MOWB.SaveAs "Afdruk.rtf" > > 'MOWB.Close > > 'moApp.Quit > > Set MOWB = Nothing > > Set moApp = Nothing > > I don't get either of those prompts using your code, even with the commented > lines uncommented. This is with Word 2007. My best guess as to why you get > them is that you have a different version of Word and the functionality is > different, or, I think there could be a setting in Word to prompt to save > templates. Or a third option might be that there's actually more code you're > not showing us. > > But I have to ask: Why are you using Word for this? Drop a RichTextBox > control onto a form and load the .rtf file in that. The obvious advantage is > that your app will not require Word be installed. If all you're doing is > showing the file, there's very little code you'd have to write, less than > you've already written to use Word to do this. > > -- > Mike- Tekst uit oorspronkelijk bericht niet weergeven - > > - Tekst uit oorspronkelijk bericht weergeven - Oke Mike, thanks T tried the same as you did: just execute this small piece of code. The first time, nothing was wrong, but executing it again caused word showing the messges again. Catharinus van der Werf csvanderwerf(a)planet.nl
From: catharinus on 13 Feb 2010 08:41 On 13 feb, 14:28, catharinus <csvanderw...(a)planet.nl> wrote: > On 13 feb, 13:19, "MikeD" <nob...(a)nowhere.edu> wrote: > > > > > > > "catharinus" <csvanderw...(a)planet.nl> wrote in message > > >news:3306601e-4dce-4d32-bbc7-8b09d97e1844(a)g28g2000yqh.googlegroups.com.... > > > > Hello to you all > > > > I use word in a vb6 application to show a rft-file. See the code > > > below. When I want to close the Word-dociument, Word asks me the > > > following: > > > "The file norma.doc already exists. Do you wnat to replace the > > > existing file" After answeering 'No' I want to close Word itself. > > > Then I get the following question: Changes have been made that affect > > > the global template. Do you wnat to save those changes" > > > > Why do I get those questions and how can I prevent those questions in > > > my vb6-application? > > > Thanks > > > Catharinus van der Werf > > > csvanderw...(a)planet.nl > > > > Set moApp = CreateObject("Word.Application") > > > moApp.Visible = False > > > cpTekst="Sample Text" > > > Set MOWB = moApp.Documents.Open("Afdruk.rtf") > > > > 'Show Word if you wish > > > moApp.Visible = True > > > 'moApp.Activate > > > > 'moApp.Selection.TypeText cpTekst '"This is sample text" > > > > 'Save the file. If the document exists it is overwriten > > > 'MOWB.SaveAs "Afdruk.rtf" > > > 'MOWB.Close > > > 'moApp.Quit > > > Set MOWB = Nothing > > > Set moApp = Nothing > > > I don't get either of those prompts using your code, even with the commented > > lines uncommented. This is with Word 2007. My best guess as to why you get > > them is that you have a different version of Word and the functionality is > > different, or, I think there could be a setting in Word to prompt to save > > templates. Or a third option might be that there's actually more code you're > > not showing us. > > > But I have to ask: Why are you using Word for this? Drop a RichTextBox > > control onto a form and load the .rtf file in that. The obvious advantage is > > that your app will not require Word be installed. If all you're doing is > > showing the file, there's very little code you'd have to write, less than > > you've already written to use Word to do this. > > > -- > > Mike- Tekst uit oorspronkelijk bericht niet weergeven - > > > - Tekst uit oorspronkelijk bericht weergeven - > > Oke Mike, thanks > > T tried the same as you did: just execute this small piece of code. > The first time, nothing was wrong, but executing it again caused word > showing the messges again. > > Catharinus van der Werf > csvanderw...(a)planet.nl- Tekst uit oorspronkelijk bericht niet weergeven - > > - Tekst uit oorspronkelijk bericht weergeven - I discoverd that the messsages appear in the last two lines. So you cannot destroy the objects???? Catharinus van der Werf
From: catharinus on 13 Feb 2010 09:21
On 13 feb, 14:41, catharinus <csvanderw...(a)planet.nl> wrote: > On 13 feb, 14:28, catharinus <csvanderw...(a)planet.nl> wrote: > > > > > > > On 13 feb, 13:19, "MikeD" <nob...(a)nowhere.edu> wrote: > > > > "catharinus" <csvanderw...(a)planet.nl> wrote in message > > > >news:3306601e-4dce-4d32-bbc7-8b09d97e1844(a)g28g2000yqh.googlegroups.com.... > > > > > Hello to you all > > > > > I use word in a vb6 application to show a rft-file. See the code > > > > below. When I want to close the Word-dociument, Word asks me the > > > > following: > > > > "The file norma.doc already exists. Do you wnat to replace the > > > > existing file" After answeering 'No' I want to close Word itself.. > > > > Then I get the following question: Changes have been made that affect > > > > the global template. Do you wnat to save those changes" > > > > > Why do I get those questions and how can I prevent those questions in > > > > my vb6-application? > > > > Thanks > > > > Catharinus van der Werf > > > > csvanderw...(a)planet.nl > > > > > Set moApp = CreateObject("Word.Application") > > > > moApp.Visible = False > > > > cpTekst="Sample Text" > > > > Set MOWB = moApp.Documents.Open("Afdruk.rtf") > > > > > 'Show Word if you wish > > > > moApp.Visible = True > > > > 'moApp.Activate > > > > > 'moApp.Selection.TypeText cpTekst '"This is sample text" > > > > > 'Save the file. If the document exists it is overwriten > > > > 'MOWB.SaveAs "Afdruk.rtf" > > > > 'MOWB.Close > > > > 'moApp.Quit > > > > Set MOWB = Nothing > > > > Set moApp = Nothing > > > > I don't get either of those prompts using your code, even with the commented > > > lines uncommented. This is with Word 2007. My best guess as to why you get > > > them is that you have a different version of Word and the functionality is > > > different, or, I think there could be a setting in Word to prompt to save > > > templates. Or a third option might be that there's actually more code you're > > > not showing us. > > > > But I have to ask: Why are you using Word for this? Drop a RichTextBox > > > control onto a form and load the .rtf file in that. The obvious advantage is > > > that your app will not require Word be installed. If all you're doing is > > > showing the file, there's very little code you'd have to write, less than > > > you've already written to use Word to do this. > > > > -- > > > Mike- Tekst uit oorspronkelijk bericht niet weergeven - > > > > - Tekst uit oorspronkelijk bericht weergeven - > > > Oke Mike, thanks > > > T tried the same as you did: just execute this small piece of code. > > The first time, nothing was wrong, but executing it again caused word > > showing the messges again. > > > Catharinus van der Werf > > csvanderw...(a)planet.nl- Tekst uit oorspronkelijk bericht niet weergeven - > > > - Tekst uit oorspronkelijk bericht weergeven - > > I discoverd that the messsages appear in the last two lines. So you > cannot destroy the objects???? > Catharinus van der Werf- Tekst uit oorspronkelijk bericht niet weergeven - > > - Tekst uit oorspronkelijk bericht weergeven - Now it works, so you cannot destroy the objects while Word is working?? Sorry Mike, for not answering your question, but what I want is to give the user of the application the ability to use word in the application itself. In fact what I want is give the user to use whatever textprogram, so for example from Open Office The same is true for a spreadsheet program: I want to give the user the opportunity to use a spreadsheet-program whenever needed. So in fact I shouldn't use the code for Word (as I shouldn't use the colde for Excel). Do you have a solution for that question? Thanks Catharinus van der Werf |