Private Function secgoppt(Optional a As String)
Dim moPptApp As PowerPoint.Application
Dim moPptPresentation As Object
Set moPptApp = CreateObject("PowerPoint.Application")
Set moPptPresentation = moPptApp.Presentations.Open(a, , , False) '打开ppt文件
'ppt没有repair模式,如果有请补充
moPptApp.DisplayAlerts = ppAlertsNone '999
moPptPresentation.SaveAs Text5.Text
moPptPresentation.Close
moPptApp.DisplayAlerts = True
'moPptApp.DisplayAlerts = ppAlertsAll 'true
moPptApp.Quit
Set moPptApp = Nothing
Set moPptPresentation = Nothing
End Function
Private Function secgoexcel(Optional a As String)
'Dim xlApp As Excel.Application
'Dim xlWorkBook As Excel.Workbook
Dim xlApp
Dim xlWorkBook
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = False
xlApp.DisplayAlerts = False
Set xlWorkBook = xlApp.Workbooks.Open(a, , , , , , , , , , , , , , xlRepairFile)
'解决打开excel文件时提示“发现不可读取的内容”,用repair模式打开即可
xlWorkBook.SaveAs Text5.Text
'Set xlsheet = Nothing '如果前面调用了dim xlsheet as excel.worksheet则关闭时要用set xlsheet = nothing
xlWorkBook.Close
Set xlWorkBook = Nothing
xlApp.Quit
Set xlApp = Nothing '放在close和quit之前move就不会执行
End Function
Private Function secgoword(Optional a As String)
Dim WordApp
Dim Document
'.DisplayAlerts = wdAlertsNone
'.DisplayAlerts = wdAlertsAll
Set WordApp = CreateObject("word.application")
WordApp.Visible = False
WordApp.DisplayAlerts = wdAlertsNone
Set Document = WordApp.Documents.Open(a, , , , , , , , , , , , , True)
Document.SaveAs Text5.Text
Document.Close
WordApp.DisplayAlerts = wdAlertsAll
WordApp.ScreenUpdating = True
On Error Resume Next
WordApp.Quit
Set WordApp = Nothing
Set Document = Nothing
End Function