Forum Discussion
enqi.angel.xu
Mar 31, 2018Copper Contributor
Complie error Expected: end of statement
Hi Everyone,
I just stared learning Excel VBA and I have copied the following code from a VBA book to VBE but it displayed the message: Complie error Expected: end of statement.
Sub Guess...
- Apr 01, 2018
I don't see anything wrong with your syntax. Guessing you had some other code in this module that was causing your issue:
Sub GuessName() Msg = "Is your name " & Application.UserName & "?" Ans = MsgBox(Msg, vbYesNo) If Ans = vbNo Then MsgBox "Oh, never mind." If Ans = vbYes Then MsgBox "I must be psychic!" End SubIf your new to VBA, then maybe it will be helpful to know the different arguments associated with MsgBox. Some of the arguments like Button and Title can make your VBA solution more polished looking and allows for greater customization.
Check the MsgBox arguments out here:
https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/msgbox-function
enqi.angel.xu
Mar 31, 2018Copper Contributor
Don't worry! This issue is resolved now, thank you all anyway!