Perry
Sat Apr 14 05:28:53 CDT 2007
Here's another tip, usefull for application developers, specifically for
"Interaction Design",
"Task Driven" design and more ... reasonably priced at Amazon.
The Inmates Are Running The Asylum, by Alan Cooper
http://www.amazon.com/exec/obidos/ASIN/0672326140/
--
Krgrds,
Perry
System:
Vista/Office Ultimate
VS2005/VSTO2005 SE
"CS Hayes" <hayes.csmontypython@gmail.com> schreef in bericht
news:396419A7-2A21-44F8-815B-2A5834716C63@microsoft.com...
> thanks for the vote of confidence.
>
> I was kind of concerned about the idea of validating input.
>
> I'm really going about something in a backward way but right now it
> appears
> the best. I came to a big realization that I had to learn Visual Basic by
> itself in some manner whatever to apply it to Access.
>
> I got a book by Steve Roman on "Programming Word" and I found his style
> best
> to my learning curve. So, I learn VB via Word programming but the final
> intent is to be able to develop solutions via Access with VB.
>
> Thanks to all who help.
>
> You're a great group of helpful professionals!
> --
> Chris Hayes
> Still a beginner (only 12 years)
>
>
> "Jay Freedman" wrote:
>
>> By Jove, I think he's got it! Well done.
>>
>> If you're going to spend some effort learning to handle user input, there
>> are a couple of principles you should know about early.
>>
>> - If you know ahead of time that the input has to be limited in some way,
>> don't make the user guess what the limits are. In this case, you know
>> that
>> you're looking for a number greater than zero, and less than or equal to
>> the
>> paragraph count. Put that information in the InputBox prompt, and the
>> user
>> won't have to wonder "Is 42 too big?". Something like this:
>>
>> inptbx = InputBox("Enter the paragraph number you want to make bold (0 -
>> " _
>> & paracount & "):", "Make a paragraph bold!")
>>
>> - Go easy on the exclamation marks. They get annoying pretty quickly.
>>
>> - In a "real" application, if the input is invalid, instead of just
>> ending
>> the macro with Exit Sub you probably want to give the user another
>> chance. A
>> simple way to do that is to put a label (an identifier followed by a
>> colon)
>> just before the InputBox statement, and replace the Exit Sub statements
>> with
>> GoTo statements pointing to that label. A better way is to make a loop
>> with
>> one of the variations on the While...Wend or Do...Loop Until statements.
>> You
>> also want to give the user a way to stop the loop -- for instance, if
>> inptbx
>> is an empty string. (The InputBox is limited and doesn't offer a Cancel
>> button. You may want to learn about UserForms, which are much more
>> powerful.)
>>
>> --
>> Regards,
>> Jay Freedman
>> Microsoft Word MVP FAQ:
http://word.mvps.org
>> Email cannot be acknowledged; please post all follow-ups to the newsgroup
>> so
>> all may benefit.
>>
>> CS Hayes wrote:
>> > Ok, this is cool. Here's my code:
>> >
>> > Sub changeparagraphbold()
>> > 'make some variables for the application
>> > Dim inptbx As String
>> > Dim inptbxnum As Single
>> > Dim paracount As Integer
>> > paracount = ActiveDocument.Paragraphs.Count
>> >
>> > 'open an input box and ask for the paragraph number you want to change
>> > inptbx = InputBox("Enter the paragraph number you want to make
>> > bold:", "Make a paragraph bold!")
>> >
>> > 'make sure the input is a number
>> > If IsNumeric(inptbx) = False Then
>> > MsgBox ("You must enter a number only!!!")
>> > Exit Sub
>> > Else
>> > End If
>> >
>> > 'make the input box output a number
>> > inptbxnum = Val(inptbx)
>> >
>> > 'make sure the number does not exceed the amount of paragraphs or is
>> > negative If inptbxnum <= 0 Then
>> > MsgBox "Number Must Be greater than Zero!!"
>> > Exit Sub
>> > ElseIf inptbx > paracount Then
>> > MsgBox "Number must not exceed documents current amount of
>> > paragraphs!!" Exit Sub
>> > End If
>> >
>> > 'make the input box selected paragraph BOLD
>> > ActiveDocument.Paragraphs(inptbxnum).Range.Font.Bold = True
>> >
>> > 'end the program
>> > End Sub
>> >
>> > Ok, I'm sure there's someone where who could write one line but I'm
>> > pretty impressed. I've been having the hardest time understanding
>> > variables and definitions but now I think I got it.
>>
>>
>>