Blog信息 |
blog名称:注册会计师(注会)练习软件 日志总数:398 评论数量:116 留言数量:27 访问次数:3273312 建立时间:2005年6月6日 |

| |
word宏对文件进行批量操作 软件技术
吕向阳 发表于 2009/3/7 0:37:09 |
Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As LongPrivate Type OPENFILENAME lStructSize As Long hwndOwner As Long hInstance As Long lpstrFilter As String lpstrCustomFilter As String nMaxCustFilter As Long nFilterIndex As Long lpstrFile As String nMaxFile As Long lpstrFileTitle As String nMaxFileTitle As Long lpstrInitialDir As String lpstrTitle As String flags As Long nFileOffset As Integer nFileExtension As Integer lpstrDefExt As String lCustData As Long lpfnHook As Long lpTemplateName As StringEnd TypeSub convfile(filename As String)Dim name As String '文件名name = filenameChangeFileOpenDirectory "F:\_delphi60prog\fromnet\" Documents.Open filename:=name, ConfirmConversions:=False, ReadOnly _ :=False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate _ :="", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="" _ , Format:=wdOpenFormatAuto, XMLTransform:="" Selection.Find.ClearFormatting With Selection.Find .Text = "<DIV 7style=" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = True .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Selection.TypeBackspace Selection.HomeKey Unit:=wdStory, Extend:=wdExtend Selection.Delete Unit:=wdCharacter, Count:=1 ActiveDocument.SaveAs filename:=name, FileFormat:=wdFormatHTML, _ LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _ :="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _ SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _ False Documents.Close savechanges
End Sub
Private Sub CommandButton1_Click()Dim filename As StringDim result As IntegerDim allcount As IntegerWith Application.FileDialog(msoFileDialogFilePicker).Title = "选择雇员照片".Filters.Add "JPEGs", "*.htm".FilterIndex = 1.AllowMultiSelect = True
result = .Showallcount = .SelectedItems.Count
If (result <> 0) ThenFor i = 1 To allcount filename = Trim(.SelectedItems.Item(i)) convfile (filename)Next i ' ActiveWindow.CloseEnd If
End WithEnd Sub
Private Sub UserForm_Click()
End Sub |
|
|