###############.......vba代码——>delphi......#############
'///////////////////////////////////////以下代码实现在指定位置插入分隔符(分页)
Sub Macro1()
'
' Macro1 Macro
' 宏在 2006-3-8 由 hyne 录制
'
Selection.InsertBreak Type:=wdSectionBreakNextPage
End Sub
'///////////////////////////////////////以下代码实现第一页加上密码(11)保护
Sub Macro2()
'
' Macro2 Macro
' 宏在 2006-3-8 由 hyne 录制
'
ActiveDocument.Sections(1).ProtectedForForms = True
ActiveDocument.Sections(2).ProtectedForForms = False
ActiveDocument.Protect Password:="11", NoReset:=False, Type:= _
wdAllowOnlyFormFields
End Sub
'///////////////////////////////////////以下代码实现第一页加上密码(11)保护
Sub Macro3()
'
' Macro3 Macro
' 宏在 2006-3-8 由 hyne 录制
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:="11"
End If
End Sub
///////////////////////////////
以上代码如何直接在delphi中用代码实现,而不用调用word中的宏?
问题点数:100、回复次数:7Top
1 楼dayusoft(偶在,古偶行!)回复于 2006-03-11 09:19:12 得分 0
//
//////////////////////////////////////以下代码实现第一页加上密码(11)保护<--写错了!:)
/////////////////////////////////////以下代码实现去除第一页密码(11)保护
Sub Macro3()
'
' Macro3 Macro
' 宏在 2006-3-8 由 hyne 录制
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:="11"
End If
End Sub
Top
2 楼aiirii(ari-http://spaces.msn.com/members/aiirii/)回复于 2006-03-11 15:31:29 得分 20
var
WordDoc: _Document;
begin
WordDoc := Word.Documents.Add(EmptyParam, EmptyParam);
// unprotect the section
WordDoc.Sections.Item(2).ProtectedForForms := False;
// fill the table with values obtained from items on the form
WordDoc.Tables.Item(1).Cell(1,2).Range.Text := DBLCClient.Text + '
- ' + DBEPlace.Text;
WordDoc.Tables.Item(1).Cell(2,2).Range.Text := DBEFax.Text;
...
// protect the section
WordDoc.Sections.Item(2).ProtectedForForms := True;
Top
3 楼dayusoft(偶在,古偶行!)回复于 2006-03-12 17:44:14 得分 0
谢谢aiirii(ari-http://spaces.msn.com/members/aiirii/) ( )
但去保护时要去除密码把,密码参数呢?
但保护时要密码把,密码参数呢?Top
4 楼dayusoft(偶在,古偶行!)回复于 2006-03-13 08:17:56 得分 0
aiirii(ari-http://spaces.msn.com/members/aiirii/) ( )?Top
5 楼dayusoft(偶在,古偶行!)回复于 2006-03-14 07:43:04 得分 0
?Top
6 楼yq3woaini(哈哈镜 选择好心情)回复于 2006-04-03 12:56:31 得分 80
来领分了,给把Top
7 楼dayusoft(偶在,古偶行!)回复于 2006-04-04 19:17:25 得分 0
下次还有问题问你呀,比如合并单元格?Top




