Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Save and SaveAs in Word
Message
De
14/08/2001 09:24:26
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
13/08/2001 00:21:12
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00542882
Message ID:
00543461
Vues:
23
>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
Ç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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform