Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Save and SaveAs in Word
Message
De
15/08/2001 11:12:54
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
15/08/2001 10:36:38
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00542882
Message ID:
00544103
Vues:
24
>>>OK,
>>>
>>>I put the last request in the wrong area. I have a piece of code that Cetin had sent to someone concerning mailmerge
>>>I use it to start word allowing the end user to edit filename passed in. Works great except I need to insure end user
>>>can not rename the file 1st scenario and Can not access the save or saveas buttons 2 scenario so we can control
>>>the name of the file user is working on. Thought adding command
>>>
>>>oWord = GetObject("","word.basic")
>>>
>>>With oWord
>>> .FileNew(myFile)
>>> .appShow
>>>*!* Allow user to edit it and then to save it
>>>EndWith
>>>*!* Use something like this
>>> .SaveAs(myFile,".doc")
>>>*!* or this...
>>> .Save(myFile,".doc")
>>> .SaveAs = 0 && False no dialog
>>>
>>>I get no errors but the saveas and save dialogs always comes up and allows me to do anything...
>>>Please Help and thanks in advance...Not Cetin's problem this is my problem not his code failing.
>>>
>>>Do it Right! Not Over...
>>>Cecil
>>
>>Cecil,
>>First IMHO there is no bulletproof way to prevent a user taking a copy of DOC once has right to open in any way. However at least user would understand s/he's getting the copy by brute force.
>>Check Thread #485474
>>If any approaches there satisfy your needs I could support it by code :)
>>Simpliest one is to open document read only. Here is skeleton code for that one ('Save' 'saveas' disabling included) :
>>
>>
#include "wdconst.h"
>>
>>oWord = createobject("Word.Application")
>>
>>lcFile = getfile('DOC')
>>if empty(lcfile)
>>	return
>>endif
>>with oWord
>>	.Documents.Open(lcFile, ,.T.)
>>	.Application.CommandBars("Standard").Controls("Save").Enabled = .F.
>>	.Application.CommandBars("File").Controls("Save").Enabled = .F.
>>	.Application.CommandBars("File").Controls("SaveAs").Enabled = .F.
>>	.visible = .t.
>>	start = datetime() && Here simply provide a delay so you could check
>>	do while datetime()-start < 60 && they're really disabled
>>	enddo
>>	* Reset them back -saved in normal.dot !!!
>>	.Application.CommandBars("Standard").Controls("Save").Enabled = .T.
>>	.Application.CommandBars("File").Controls("Save").Enabled = .T.
>>	.Application.CommandBars("File").Controls("SaveAs").Enabled = .T.
>>endwith
Cetin
>
>Cretin,
>
>Well I want to say thank you to all the people who have been good enough to answer my question. Will look in archives for copy of wdConst.h these are not part of my msword.h that I created from normal.dot but is this for a specific version of word. Thanks again. Cecil
>
>Cecil
>
>Do it Right! Not Over!!!

Cecil,
wdconst.h is my naming here. It's .h file for Word97, might be with a different name elsewhere (and should be in downloads area).
Pls note that unlike old code word.application is used not word.basic
WordBasic exists in word97 and up as an object :
oWord = createobject('word.application')
with oWord.WordBasic
 .FileNew
is still legal. However not all word.basic commands work as expected with this approach. Try to use new commands.
BTW I'm assuming youy're targeting word97 and up.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform