When you use a function like I see posted here often, like:
Public Function Whatever()
stuff...
End Function
What do you actually do with that to make it run? I assumed you put it in a
module. If I do that and hit the run sub/user form button I get a popup
asking me for a Macro Name. I'm not sure what to do from here.
Maybe someone can show me where to start reading on using funcitons? I start
looking through the help files but quickly get overwhelmed. Seems like
almost all subjects start past the point of square 1, like you're already
supposed to know a bunch of things before help topics even get going. 7 1600
You can type Whatever() in the inmediate window (CTR+G) to see what it
does, or run it in any procedure in your project, again just by typing
its name
There are various ways to make your public functions run; From the Immediate window to make the example functionrun, type the
following and press enter;
?whatever
To get it to run from an event, within the VBA window of the
form/report you could put the following in the chosen event;
Call Whatever
The function is run when the event is fired.
I'm sure there are others who can explain this more elegantly and
expand on your question.
Hope this helps though.
Cheers
Phil
Alan wrote: When you use a function like I see posted here often, like:
Public Function Whatever() stuff... End Function
What do you actually do with that to make it run? I assumed you put it in a module. If I do that and hit the run sub/user form button I get a popup asking me for a Macro Name. I'm not sure what to do from here.
Maybe someone can show me where to start reading on using funcitons? I start looking through the help files but quickly get overwhelmed. Seems like almost all subjects start past the point of square 1, like you're already supposed to know a bunch of things before help topics even get going.
Hi, Alan. What do you actually do with that to make it run? I assumed you put it in a module. If I do that and hit the run sub/user form button I get a popup asking me for a Macro Name. I'm not sure what to do from here.
If it's a function or subroutine that doesn't accept any parameters, then
you can test it by placing your curson on the first line of the procedure:
Public Function Whatever() As String
.. . . and then hit the Run button (or hit <F5> or use the Run -> Run
Sub/UserForm menu), to run the procedure. If the procedure accepts
parameters, then you'll have to call this procedure from another. For
example:
Public Sub testingWhatever()
Dim myVariable As String
myVariable = "today"
MsgBox Whatever(myVariable)
End Sub
.. . . and just place the cursor on the first line of testingWhatever() and
then hit Run to find out what "today" brings you.
HTH.
Gunny
See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials. http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
"Alan" <Al********@msn.com> wrote in message
news:97*******************@216.196.97.136... When you use a function like I see posted here often, like:
Public Function Whatever() stuff... End Function
What do you actually do with that to make it run? I assumed you put it in a module. If I do that and hit the run sub/user form button I get a popup asking me for a Macro Name. I'm not sure what to do from here.
Maybe someone can show me where to start reading on using funcitons? I start looking through the help files but quickly get overwhelmed. Seems like almost all subjects start past the point of square 1, like you're already supposed to know a bunch of things before help topics even get going.
"Alan" <Al********@msn.com> wrote in message
news:97*******************@216.196.97.136... What do you actually do with that to make it run? I assumed you put it in a module. If I do that and hit the run sub/user form button I get a popup asking me for a Macro Name. I'm not sure what to do from here.
If the cursor is not within a procedure, VBA does not know what procedure to
run, so it gives you the popup to select from.
John... Visio MVP
Hi, John.
Even if the cursor is within a procedure when the Run button is hit, the
popup asking for a macro name can still show up. It happens with class
modules and with procedures that require parameters.
HTH.
Gunny
See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials. http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
"John Marshall, MVP" <la******@stonehenge.ca> wrote in message
news:35********************@magma.ca... "Alan" <Al********@msn.com> wrote in message news:97*******************@216.196.97.136... What do you actually do with that to make it run? I assumed you put it in a module. If I do that and hit the run sub/user form button I get a popup asking me for a Macro Name. I'm not sure what to do from here.
If the cursor is not within a procedure, VBA does not know what procedure to run, so it gives you the popup to select from.
John... Visio MVP
True. I was trying to explain why the popup was there without going into too
much details on the exceptions. The cursor can be within a procedure that
does not have parameters, but if the window does not have focus, VBA will
give the popup.
John... Visio MVP
"'69 Camaro" <Fo**************************@Spameater.orgZERO_SP AM> wrote in
message news:w-******************************@adelphia.com... Hi, John.
Even if the cursor is within a procedure when the Run button is hit, the popup asking for a macro name can still show up. It happens with class modules and with procedures that require parameters.
HTH. Gunny
See http://www.QBuilt.com for all your database needs. See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials. http://www.Access.QBuilt.com/html/ex...ributors2.html for contact info.
"John Marshall, MVP" <la******@stonehenge.ca> wrote in message news:35********************@magma.ca... "Alan" <Al********@msn.com> wrote in message news:97*******************@216.196.97.136... What do you actually do with that to make it run? I assumed you put it in a module. If I do that and hit the run sub/user form button I get a popup asking me for a Macro Name. I'm not sure what to do from here.
If the cursor is not within a procedure, VBA does not know what procedure to run, so it gives you the popup to select from.
John... Visio MVP
Hi, John.
I learn something new every day. Thanks for testing that. It would never
occur to me to run a procedure from the VB Editor during testing that I
wasn't currently looking at.
Gunny
See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials. http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
"John Marshall, MVP" <la******@stonehenge.ca> wrote in message
news:3r******************************@magma.ca... True. I was trying to explain why the popup was there without going into too much details on the exceptions. The cursor can be within a procedure that does not have parameters, but if the window does not have focus, VBA will give the popup.
John... Visio MVP
"'69 Camaro" <Fo**************************@Spameater.orgZERO_SP AM> wrote in message news:w-******************************@adelphia.com... Hi, John.
Even if the cursor is within a procedure when the Run button is hit, the popup asking for a macro name can still show up. It happens with class modules and with procedures that require parameters.
HTH. Gunny
See http://www.QBuilt.com for all your database needs. See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials. http://www.Access.QBuilt.com/html/ex...ributors2.html for contact info.
"John Marshall, MVP" <la******@stonehenge.ca> wrote in message news:35********************@magma.ca... "Alan" <Al********@msn.com> wrote in message news:97*******************@216.196.97.136...
What do you actually do with that to make it run? I assumed you put it in a module. If I do that and hit the run sub/user form button I get a popup asking me for a Macro Name. I'm not sure what to do from here.
If the cursor is not within a procedure, VBA does not know what procedure to run, so it gives you the popup to select from.
John... Visio MVP This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Matt |
last post by:
I'd like to overwrite just one line of a binary file, based on a
position set by seek(). Is there no way to do this? As far as I can
tell I need to read the whole file, change the line, and write...
|
by: Anupam Kapoor |
last post by:
hi all,
a python n00b, so please bear with me. i have a simple question:
i generally name python sources as a-simple-python-example.py. when i
try to import a module named as above, i...
|
by: newgenre |
last post by:
I am using a pre-built package of code for my site, which is called
EasyDisc. All it does is it creates an interactive forum on your site, like
any forum you see anywhere.
I am having a problem...
|
by: onefry |
last post by:
Hey I have this prog that i'm working on, starting my first c++ class and kind of a n00b to programming
here it is
#include <iostream>
#include <cstdlib>
using namespace std;
|
by: Charles |
last post by:
I am learning from the Accelerated C++ book. The following example
doesn't work and I don't know why:
#include <iostream>
#include <string>
int main () {
const std::string exclam = "!";
const...
|
by: tasteless |
last post by:
Hi guys,
I need really hard questions (about 10) about PHP programming (some of
elements OOP as well, but no MySQL questions - this is different part),
this questions needs to be very hard, but...
|
by: rtlshred |
last post by:
Hello
I have just, just started C++ programing. the complier I am using is Dev C++
Here is my question:
Once I have written some code, How do I run the program and see the output?
|
by: benwah1983 |
last post by:
Greetings,
Here is my problem:
The following code shows a div with two small nested divs (images with a title), then the div is closed. Another one opens and a "random text" is displayed.
<div...
|
by: Alec |
last post by:
Sorry guys, stupid question....
Am no programming expert and have only just started using php for
creating dynamic news pages.
Then I see a dynamic website without the php extension.
...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |