更改excle檔案類型xls 至 xlsx

文章描述了如何使用Remexcel库将位于特定路径的XLS文件转换为XLSX格式,并模拟用户在Excel中进行另存新档的过程,包括删除旧文件、打开工作簿、设置文件名等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


=========================================================================
rem excel更改檔案類型從xls變更為xlsx
userpath = Sys.GetHomePath()
filepath = userpath&'''\desktop\uibot\projects\ACON\ZMM1003\'''
Rem 檢查檔案是否存在, 若存在, 則刪除
bRet = File.FileExists(filepath&"receiving.xlsx")
If bret
    
    File.DeleteFile(filepath&"receiving.xlsx")
Else
    
End If
objExcelWorkBook = Excel.OpenExcel(filepath&"receiving.xls",True,"Excel","","")
Delay(5000)
Keyboard.Press("F12", "press", [],{"iDelayAfter":500,"iDelayBefore":200,"sSimulate":"simulate"})
Delay(200)
#icon("@res:0l0iqdvh-tenn-55sc-a2p9-8srbge7o4ath.png")
Keyboard.InputText({"wnd":[{"app":"EXCEL","cls":"#32770","title":"另存新檔"},{"cls":"DUIViewWndClassName"},{"cls":"DirectUIHWND","aaname":"檔案總管窗格"},{"cls":"FloatNotifySink"},{"cls":"ComboBox","aaname":"檔案名稱:"},{"cls":"Edit","ctrlid":1001,"aaname":"檔案名稱:"}]},"receiving",True,20,10000,{"bContinueOnError":False,"iDelayAfter":300,"iDelayBefore":500,"bSetForeground":True,"sSimulate":"message","bValidate":False,"bClickBeforeInput":False})
Delay(200)
Keyboard.Press("Tab", "press", [],{"iDelayAfter":500,"iDelayBefore":200,"sSimulate":"simulate"})
Delay(200)
Keyboard.Press("Down", "press", [],{"iDelayAfter":500,"iDelayBefore":200,"sSimulate":"simulate"})
Delay(200)
Keyboard.Press("Home", "press", [],{"iDelayAfter":500,"iDelayBefore":200,"sSimulate":"simulate"})
Delay(200)
Keyboard.Press("Enter", "press", [],{"iDelayAfter":500,"iDelayBefore":200,"sSimulate":"simulate"})
Delay(200)
Keyboard.Press("S", "press", ["Alt"],{"iDelayAfter":500,"iDelayBefore":200,"sSimulate":"simulate"})
Delay(200)
Excel.CloseExcel(objExcelWorkBook,True)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值