如何在VBScript中使用別名?我想下面的代碼:VBS中的別名錯誤
AliasesExample
Sub AliasesExample
Dim AliasObj
' Obtains the object that corresponds to the Notepad main window
Set AliasObj = Aliases.notepad.wndNotepad
' Checks whether the specified window exists
If AliasObj.Exists Then
' Enters text in the Notepad editor
AliasObj.Keys("Hello, world.")
Else
Log.Error("Notepad is not running.")
End If
End Sub
但得到以下錯誤:
object required: 'Aliases'
您需要添加更多的代碼。顯示別名是什麼,它被設置爲什麼。目前我不知道你在做什麼。 –
問題根據您的要求更新。現在這是完整的代碼。 – RedLeo
謝謝,但別名是什麼?這不是內置於Excel的內容,那它是什麼?我希望它從你顯示的代碼中爲空,所以Aliases.notepad.wndNotepad可能會出錯。事實上,錯誤表示別名爲空。那麼它應該是什麼? –