|
- Sub doc2htm()
- On Error Resume Next
- Dim fd As FileDialog, i As Long, doc As Document, p As String
- Set fd = Application.FileDialog(msoFileDialogFolderPicker)
- If fd.Show = -1 Then p = fd.SelectedItems(1) Else Exit Sub
- Set fd = Nothing
- If MsgBox("Are you sure to convert? (" & p & ")", vbYesNo + vbExclamation, "doc2htm") = vbNo Then Exit Sub
- With Application.FileSearch
- .LookIn = p
- .SearchSubFolders = True
- .FileName = "*.doc"
- If .Execute > 0 Then
- For i = 1 To .FoundFiles.Count
- Set doc = Documents.Open(FileName:=.FoundFiles(i))
- doc.SaveAs FileName:=Left(doc.FullName, Len(doc.FullName) - 4) & ".htm", FileFormat:=wdFormatHTML
- ActiveDocument.Close
- Next i
- MsgBox "Complete! There were " & .FoundFiles.Count & " file(s) converted.", vbOKOnly + vbExclamation, "doc2htm"
- Else
- MsgBox "There were no files found.", vbOKOnly + vbCritical, "doc2htm"
- End If
- End With
- End Sub
复制代码 这个宏word2003才能使用,请问怎么样修改才能改成word2007也能使用呢?谢谢大家!
|
|