Convert xlsx to XLS with VB

Source: Internet
Author: User

Sub Test ()
Dim WB as Workbook, MPath as String, F as String
Application.DisplayAlerts = False
application.screenupdating = False
Application.calculation = xlcalculationmanual
If workbooks.count > 1 then MsgBox "Close the other workbooks and try again!" ": Exit Sub
MsgBox "Select the folder where the. xlsx file is located! "
With Application.filedialog (msoFileDialogFolderPicker)
. Show
. AllowMultiSelect = False
If. Selecteditems.count = 0 Then MsgBox "You gave up the operation!" ": Exit Sub
MPath =. SelectedItems (1)
End with
f = Dir (MPath & "\*.xlsx")
Do and F <> ""
If f <> Thisworkbook.name and left (F, Len (f)-1) <> Thisworkbook.name Then
Set wb = Workbooks.Open (MPath & "\" & F,, False)
Wb. SaveAs Filename:=mpath & "\" & Left (F, Len (f)-1), Fileformat:=xlexcel8
Wb. Close True
Kill MPath & "\" & F
End If
f = Dir
Loop
Application.DisplayAlerts = True
application.screenupdating = True
Application.calculation = xlcalculationautomatic
MsgBox "Processing done! "
End Sub

Convert xlsx to XLS with VB

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.