#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 337
Default NoPrompt

What does the following code mean "(Optional NoPrompt As Boolean = False)" in
this line of code?

Sub SaveNewJob(Optional NoPrompt As Boolean = False)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default NoPrompt

in the brackets are the arguments for the sub
NoPrompt is a named variable for passing an argument
Optional means it is not required
=False means that if no argument is stated the default value is false

savenewjob = SaveNewJob false

without loooking at code no telling what NoPrompt does -
in well written code
it might mean that the sub will sve without prompting the user ?

"Oldjay" wrote:

What does the following code mean "(Optional NoPrompt As Boolean = False)" in
this line of code?

Sub SaveNewJob(Optional NoPrompt As Boolean = False)

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default NoPrompt

It means that the macro tests a variable NoPrompt. The macro will assume it
is set to False, but when calling the macro, you can pass a value of True to
force a different action.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Oldjay" wrote in message
...
What does the following code mean "(Optional NoPrompt As Boolean = False)"

in
this line of code?

Sub SaveNewJob(Optional NoPrompt As Boolean = False)



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 337
Default NoPrompt

I can't find where the varable NoPrompt is defined. I have searched the whole
project.

I have found

If NoPrompt Then
JobNumber = "\\SERVER3\Jobs\Estimate1\NEW_JOBS1\" & Numbersave
Else
JobNumber = InputBox("Please enter JOB file name to save", "The
d Company", "\\SERVER3\Jobs\Estimate1\NEW_JOBS1\" & Numbersave)
End If

"Bob Phillips" wrote:

It means that the macro tests a variable NoPrompt. The macro will assume it
is set to False, but when calling the macro, you can pass a value of True to
force a different action.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Oldjay" wrote in message
...
What does the following code mean "(Optional NoPrompt As Boolean = False)"

in
this line of code?

Sub SaveNewJob(Optional NoPrompt As Boolean = False)




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default NoPrompt

That is it,

If NoPrompt Then

is the same as

If NoPrompt = True Then

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Oldjay" wrote in message
...
I can't find where the varable NoPrompt is defined. I have searched the

whole
project.

I have found

If NoPrompt Then
JobNumber = "\\SERVER3\Jobs\Estimate1\NEW_JOBS1\" & Numbersave
Else
JobNumber = InputBox("Please enter JOB file name to save",

"The
d Company", "\\SERVER3\Jobs\Estimate1\NEW_JOBS1\" & Numbersave)
End If

"Bob Phillips" wrote:

It means that the macro tests a variable NoPrompt. The macro will assume

it
is set to False, but when calling the macro, you can pass a value of

True to
force a different action.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Oldjay" wrote in message
...
What does the following code mean "(Optional NoPrompt As Boolean =

False)"
in
this line of code?

Sub SaveNewJob(Optional NoPrompt As Boolean = False)








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default NoPrompt

This is a function, so NoPrompt is a placeholder. Any Boolean variable or
boolean constant may be passed to the function - the variable does not have
to be call NoPrompt. Also, since the variable is shown as an optional
argument, the calling functions are not required to pass any variable.

--
Regards,
Tom Ogilvy

"Oldjay" wrote in message
...
I can't find where the varable NoPrompt is defined. I have searched the

whole
project.

I have found

If NoPrompt Then
JobNumber = "\\SERVER3\Jobs\Estimate1\NEW_JOBS1\" & Numbersave
Else
JobNumber = InputBox("Please enter JOB file name to save",

"The
d Company", "\\SERVER3\Jobs\Estimate1\NEW_JOBS1\" & Numbersave)
End If

"Bob Phillips" wrote:

It means that the macro tests a variable NoPrompt. The macro will assume

it
is set to False, but when calling the macro, you can pass a value of

True to
force a different action.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Oldjay" wrote in message
...
What does the following code mean "(Optional NoPrompt As Boolean =

False)"
in
this line of code?

Sub SaveNewJob(Optional NoPrompt As Boolean = False)






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 337
Default NoPrompt

My problem is what changes NoPrompt to true.
I can't find any referenceto it except the If- Then - Else

"Tom Ogilvy" wrote:

This is a function, so NoPrompt is a placeholder. Any Boolean variable or
boolean constant may be passed to the function - the variable does not have
to be call NoPrompt. Also, since the variable is shown as an optional
argument, the calling functions are not required to pass any variable.

--
Regards,
Tom Ogilvy

"Oldjay" wrote in message
...
I can't find where the varable NoPrompt is defined. I have searched the

whole
project.

I have found

If NoPrompt Then
JobNumber = "\\SERVER3\Jobs\Estimate1\NEW_JOBS1\" & Numbersave
Else
JobNumber = InputBox("Please enter JOB file name to save",

"The
d Company", "\\SERVER3\Jobs\Estimate1\NEW_JOBS1\" & Numbersave)
End If

"Bob Phillips" wrote:

It means that the macro tests a variable NoPrompt. The macro will assume

it
is set to False, but when calling the macro, you can pass a value of

True to
force a different action.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Oldjay" wrote in message
...
What does the following code mean "(Optional NoPrompt As Boolean =

False)"
in
this line of code?

Sub SaveNewJob(Optional NoPrompt As Boolean = False)






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default NoPrompt

Oldjay,
You have find where this Sub is called from, where presumably you will find:
SaveNewJob True
or
Call SaveNewJob(True)

NickHK

"Oldjay" wrote in message
...
My problem is what changes NoPrompt to true.
I can't find any referenceto it except the If- Then - Else

"Tom Ogilvy" wrote:

This is a function, so NoPrompt is a placeholder. Any Boolean variable

or
boolean constant may be passed to the function - the variable does not

have
to be call NoPrompt. Also, since the variable is shown as an optional
argument, the calling functions are not required to pass any variable.

--
Regards,
Tom Ogilvy

"Oldjay" wrote in message
...
I can't find where the varable NoPrompt is defined. I have searched

the
whole
project.

I have found

If NoPrompt Then
JobNumber = "\\SERVER3\Jobs\Estimate1\NEW_JOBS1\" &

Numbersave
Else
JobNumber = InputBox("Please enter JOB file name to save",

"The
d Company", "\\SERVER3\Jobs\Estimate1\NEW_JOBS1\" & Numbersave)
End If

"Bob Phillips" wrote:

It means that the macro tests a variable NoPrompt. The macro will

assume
it
is set to False, but when calling the macro, you can pass a value of

True to
force a different action.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Oldjay" wrote in message
...
What does the following code mean "(Optional NoPrompt As Boolean =

False)"
in
this line of code?

Sub SaveNewJob(Optional NoPrompt As Boolean = False)








  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default NoPrompt

It means that the parameter called NoPrompt is optional - it can be left
blank if desired. If the value is supplied by the calling procedure, e.g.
SaveNewJob(True), then the value of NoPrompt will be as specified at the time
of the call. If it is not specified, e.g. SaveNewJob, then the sub will use
the default value of False (the "= False" at the end of the parameter
specification is telling it what the default value for NoPrompt is if it is
not specified by the calling procedure)

--
- K Dales


"Oldjay" wrote:

What does the following code mean "(Optional NoPrompt As Boolean = False)" in
this line of code?

Sub SaveNewJob(Optional NoPrompt As Boolean = False)

Reply
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



All times are GMT +1. The time now is 09:13 AM.

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

About Us

"It's about Microsoft Excel"