LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default Getting a message box program to run (Page 43 of 'BeginningProgramming with VBA' by Duane Birnham)

Dear Programmers,

I seem to be running into difficulty running the following program in Excel.

I have made a Command Button and called it cmdBegin and given its caption as Begin in the properties window.

However upon pressing the button in the Excel Spreadsheet, it returns as an error (a yellow arrow) that the first line:

Private Sub cmd Begin_click()

is not defined.

I can't get the Book's website as it seems the UK branch is defunct, though they tout their website on the back cover and in the text a lot, they don't actually specify what or where it is, and how it might be accessed.

Anyhow I thought I might try Googlegroups for help.

This is the text of the program in question:-
----------------------------------------------------------------------------
Private Sub cmdBegin_Click( )
Dim userName As String
Dim firstName As String
Dim lastName As String
Dim strLength As Integer
Dim spaceLoc As Integer
'----------------------------
'Collect user name, find the space between
'first and last names, and separate the names.
'------------------------------------------------
userName = InputBox("Enter your first and last name.", "Name")
spaceLoc = InStr(1,userName," ")
firstName = Left(userName, spaceLoc - 1)
'-----------------------------------------------
'Output to the worksheet
'-----------------------------------------------
Range("C3").Value = firstName
strLength = Len(firstName)
Range("C4").Value = strLength 'length of first name
strLength = Len(userName)
lastName = Mid(userName, spacelLoc + 1, strLength - spaceLoc)
Range("C5").Value = lastName
strLength = Len(lastName)
Range("C6").Value = strLength
Range("C7").Value = UCase(userName)
Range("C8").Value = LCase(userName)
Range("C9").Value = StrConv(userName, vbProperCase)
Range("C10").Value = StrReverse(userName)
Range("C11").Value = lastName & ", " & firstName
End Sub
----------------------------------------------------------------------------
Hope you can tell me what is going wrong, thank you for your help in advance.
Yours
Simon Evans
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add Message While Program is Working maperalia Excel Programming 7 April 22nd 06 04:16 AM
How do I program a message box with a (Yes),( No) buttons DeJon Excel Programming 2 March 10th 06 03:11 AM
How to acknowledge a message box from VB program? Darwin Excel Programming 2 May 29th 04 02:15 PM
message box program flow losmac Excel Programming 0 August 21st 03 09:36 PM
message box program flow Chip Pearson Excel Programming 0 August 19th 03 09:54 PM


All times are GMT +1. The time now is 03:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"