久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

Excel xls與xlsx互轉(zhuǎn)代碼

 leexingyuan5 2017-03-24
不能發(fā)附件,自己建窗體
代碼如下
VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} myCover
   Caption         =   "EXCLE批量轉(zhuǎn)換格式"
   ClientHeight    =   4200
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   4785
   OleObjectBlob   =   "myCover.frx":0000
   StartUpPosition =   1  '所有者中心
End
Attribute VB_Name = "myCover"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CommandButton1_Click()
Dim myFiles
Dim myDirS, myDirO As String
Dim i As Long

If Application.Version = "11.0" Then
MsgBox ("老大,,Excel2003不能打開高版本文件,,請?jiān)?7以上版本進(jìn)行轉(zhuǎn)換!")
Exit Sub
End If
If TextBox1.Value = "" Then
MsgBox ("老大,,你沒有指定路徑,,讓我轉(zhuǎn)空氣啊,?")
Exit Sub
ElseIf Dir(TextBox1.Value, vbDirectory) = vbNullString Then
MsgBox ("老大,,你確定源文件路徑真的存在?")
Exit Sub
End If

If TextBox2.Value = "" Then TextBox2.Value = TextBox1.Value
'處理路徑
If Right(TextBox1.Value, 1) = "\" Then TextBox1.Value = Left(TextBox1.Value, Len(TextBox1.Value) - 1)
If Right(TextBox2.Value, 1) = "\" Then TextBox2.Value = Left(TextBox2.Value, Len(TextBox2.Value) - 1)


myDirS = TextBox1.Value
myDirO = TextBox2.Value
'目標(biāo)路徑不存在時先建立
If Dir(myDirO, vbDirectory) = "" Then MkDir myDirO

On Error Resume Next
Application.ScreenUpdating = True
Application.DisplayAlerts = False
If OptionButton1.Value = True Then
'07-13格式轉(zhuǎn)03格式
myFiles = Dir(myDirS & "\*.xlsx")
Do While myFiles <> ""
Workbooks.Open Filename:=myDirS & "\" & myFiles
ActiveWorkbook.SaveAs Filename:= _
myDirO & "\" & Left(myFiles, Len(myFiles) - 1), FileFormat:=xlExcel8, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWindow.Close
'刪除源文件
If CheckBox1.Value = False Then Kill myDirS & "\" & myFiles
i = i + 1
myFiles = Dir
DoEvents
Loop
MsgBox "全部轉(zhuǎn)換完畢,,共轉(zhuǎn)換文件 " & i & "個"
'03格式轉(zhuǎn)07-13格式
Else
myFiles = Dir(myDirS & "\*.xls")
Do While myFiles <> ""
If Right(myFiles, 1) = "x" Then GoTo NF
Workbooks.Open Filename:=myDirS & "\" & myFiles
ActiveWorkbook.SaveAs Filename:= _
myDirO & "\" & myFiles & "x", FileFormat:=xlOpenXMLWorkbook, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWindow.Close
i = i + 1
'刪除源文件
If CheckBox1.Value = False Then Kill myDirS & "\" & myFiles
NF:
myFiles = Dir
DoEvents
Loop
MsgBox "全部轉(zhuǎn)換完畢,,共轉(zhuǎn)換文件 " & i & "個"
End If

End Sub

Private Sub CommandButton2_Click()
Unload Me
End Sub

' 窗體初始化
Private Sub UserForm_Initialize()
TextBox1.Value = ActiveWorkbook.Path
    TextBox1.SetFocus
End Sub

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,,不代表本站觀點(diǎn),。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報,。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多