View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Assignment to constant not permitted

Hi Grace,

Change the line: Default = ""
to: strDefault = ""
as this is a VBA reserved name.

It is also highly advisable to head your module with : Option Explicit

and appropriately dim your variables.

If you were to do this, your code might look like this:

Sub Test()
Dim strMessage As String, StrTitle As String, _
StrDefault As String, StrMGR_LONG_NAME As String

strMessage = "ENTER LONG DISPLAY NAME OF WRAP MANAGER"
StrTitle = ""
StrDefault = ""
StrMGR_LONG_NAME = InputBox(strMessage, StrTitle, StrDefault)
Sheets("INPUTS").Range("C11").Value = StrMGR_LONG_NAME

End Sub

---
Regards,
Norman


"Grace" wrote in message
...
I just found an old sample I was trying to adapt for a message box. But, in
my new spreadsheet, the macro crashes when I try to run it. It stops on the
Default command and says "assignment to constant not permitted". What am I
forgetting? Here is the macro:

Message = "ENTER LONG DISPLAY NAME OF WRAP MANAGER"
Title = ""
Default = ""
MGR_LONG_NAME = InputBox(Message, Title, Default)
Sheets("INPUTS").Range("C11").Value = MGR_LONG_NAME

Thanks,
Grace