如何使用Delphi调用VBA来实现Word文档的加密码?(50分)

  • 主题发起人 主题发起人 mengmengbug
  • 开始时间 开始时间
M

mengmengbug

Unregistered / Unconfirmed
GUEST, unregistred user!
如题,请详细一些
谢谢!!
 
var
FileName,FileFormat,LockComments,Password,AddToRecentFiles,WritePassword,ReadOnlyRecommended,EmbedTrueTypeFonts,SaveNativePictureFormat,SaveFormsData,SaveAsAOCELetter:oleVariant

FileName:='dfasdf.doc';
FileFormat:=wdFormatDocument;
LockComments:=False;
Password:='123';
AddToRecentFiles:=True;
WritePassword:='456';
ReadOnlyRecommended:=False;
EmbedTrueTypeFonts:=False;
SaveNativePictureFormat:=False;
SaveFormsData:=False;
SaveAsAOCELetter:=False;

WordApplication1.ActiveDocument.SaveAs(FileName,FileFormat,LockComments,Password,AddToRecentFiles,WritePassword,ReadOnlyRecommended,EmbedTrueTypeFonts,SaveNativePictureFormat,SaveFormsData,SaveAsAOCELetter);


FileName:="dfasdf.doc", FileFormat:=wdFormatDocument _
, LockComments:=False, Password:="123", AddToRecentFiles:=True, _
WritePassword:="456", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
 
var
FileName,FileFormat,LockComments,Password,AddToRecentFiles,WritePassword,ReadOnlyRecommended,EmbedTrueTypeFonts,SaveNativePictureFormat,SaveFormsData,SaveAsAOCELetter:oleVariant

FileName:='c:/d.doc';
FileFormat:=wdFormatDocument;
LockComments:=False;
Password:='123';//打开密码
AddToRecentFiles:=True;
WritePassword:='456'; //修改密码
ReadOnlyRecommended:=False;
EmbedTrueTypeFonts:=False;
SaveNativePictureFormat:=False;
SaveFormsData:=False;
SaveAsAOCELetter:=False;

WordApplication1.ActiveDocument.SaveAs(FileName,FileFormat,LockComments,Password,AddToRecentFiles,WritePassword,ReadOnlyRecommended,EmbedTrueTypeFonts,SaveNativePictureFormat,SaveFormsData,SaveAsAOCELetter);


 
后退
顶部