如何将如下VBA转换成au3,谢谢
如何将如下VBA转换成au3,谢谢Private Function SheetExists(sname) As Boolean
'如果活动工作簿中存在表SNAME则返回真
Dim x As Object
On Error Resume Next
Set x = ActiveWorkbook.Sheets(sname)
If Err = 0 Then SheetExists = True _
Else SheetExists = False
End Function au3的代码,有没有更高效率的写法????
sheetexists()
Func SheetExists()
$oExcel = _ExcelBookNew()
$x = $oExcel.ActiveWorkbook.Sheets.Count
For $i = 1 To $x
If $oExcel.ActiveWorkbook.Sheets($i).Name = "sheet10" Then
MsgBox(0,"aaa", "工作表已存在")
Exit
EndIf
Next
MsgBox(0,"aaa", "工作表不存在")
EndFunc VBS转AU3
Dim $F = FileOpen(@TempDir & "\1.vbs", 2)
FileWriteLine($F, '这里写VBS代码') ;FileWriteLine需要一行一行写
FileClose($F)
RunWait(@ComSpec & " /c call " & @TempDir & "\1.vbs", @ScriptDir, @SW_HIDE)
FileDelete(@TempDir & "\1.vbs") 不是用au3生成vbs,而是将vba的代码变成au3的代码。
页:
[1]