Breaking User Form Code into modules question

I have a user form with alot of code in it. As of now all the code is in the 
Userform
Code window, but there is so much code that it's getting confusing. I have 
one Sub that is to large and needs to be split into several subs.

When I was done I was going to break all the Subs down into different 
modules to clean it up. I guess I will have to do that now, but I am not sure 
how to do it.

1: My question is in the UserForm Code Window how do I refer to a module?
2: If the Code is to large can one Module call another module?
    Something like User form Code calls Module 1 and at the end of module 1 
code, it calls for module 2, etc....
3: Most of my Code is With statements / End With then more code. 


Here is an Example of the Code in the UserForm Code Window:
Private Sub Update_Installer_Forms_10_Click()
 
   With Workbooks("Master Installer Forms.xlsm").Sheets("Install Pack Con")
              **Code for the sub is here**
           End With
 
    With Workbooks("Master Installer Forms.xlsm").Sheets("Install Chk List")
              **Code for the sub is here**
            End With

End Sub

I really need to sort this out so it's not so confusing to work on. Can 
anyone please help me or explain it in english to me. 

0
Utf
2/2/2010 6:14:03 PM
excel.programming 6508 articles. 2 followers. Follow

9 Replies
903 Views

Similar Articles

[PageSpeed] 24

Hi Brian,

1: My question is in the UserForm Code Window how do I refer to a module?

A1:  You can call any procedure that is in the public modules (Module1, 
Mocule2, etc.) from the UserForm code module.  If you are using event code 
to respond to some user's interaction, then in the event code you would call 
the working procedure out of the public module:

     Private Sub Listbox1_Click()
           Call Macro1       'Macro1 located in Module1
    End Sub

2: If the Code is to large can one Module call another module?
    Something like User form Code calls Module 1 and at the end of module 1
code, it calls for module 2, etc...

   A2:  Yes, any public module can call from and respond to any other public 
module.
..
3: Most of my Code is With statements / End With then more code.

    A3:  So?  That is just a style of writing code.  I do not believe it 
would influence whether the code can be called from another module or not.

As a general rule, private procedures can call any public procedure, but the 
reverse is not necessarily true.


"Brian" <Brian@discussions.microsoft.com> wrote in message 
news:260E2CF1-1B0E-4444-AAE8-0F200427B42C@microsoft.com...
>I have a user form with alot of code in it. As of now all the code is in 
>the
> Userform
> Code window, but there is so much code that it's getting confusing. I have
> one Sub that is to large and needs to be split into several subs.
>
> When I was done I was going to break all the Subs down into different
> modules to clean it up. I guess I will have to do that now, but I am not 
> sure
> how to do it.
>
> 1: My question is in the UserForm Code Window how do I refer to a module?
> 2: If the Code is to large can one Module call another module?
>    Something like User form Code calls Module 1 and at the end of module 1
> code, it calls for module 2, etc....
> 3: Most of my Code is With statements / End With then more code.
>
>
> Here is an Example of the Code in the UserForm Code Window:
> Private Sub Update_Installer_Forms_10_Click()
>
>   With Workbooks("Master Installer Forms.xlsm").Sheets("Install Pack Con")
>              **Code for the sub is here**
>           End With
>
>    With Workbooks("Master Installer Forms.xlsm").Sheets("Install Chk 
> List")
>              **Code for the sub is here**
>            End With
>
> End Sub
>
> I really need to sort this out so it's not so confusing to work on. Can
> anyone please help me or explain it in english to me.
> 


0
JLGWhiz
2/2/2010 6:38:47 PM
You have a lot of flexibility in the ways you can distribute code
within modules. I generally organize code as follows. First, the only
code that resides in a user form's code module is that code required
directly by the form -- that is, event procedures for each control.
Similarly, the only code that resides in ThisWorkbook or one of the
Sheet module is the event handling for the object, and those
procedures should generally just call other procedures located
elsewhere to do the real work. Keep the core logic out of ThisWorkbook
the sheet modules and user forms.

Everything else goes in other modules. Code is distributed amongst
several modules based on the code's function. General utility
functions in one module, data access functions in another, and core
business functionality in yet another module or two. 

Procedures should be as generic as possible, allowing them to be
called in many circumstances without changing any code. All relevant
information should be passed in as parameters. Module- or
Project-scoped variables should be avoided as much as possible. If a
procedure relies on a value that is not passed in (and thus can be
modified by other code), you run the risk of unintentional side
effects that arise when you change a seemingly unrelated procedure
that modifies a non-parameter or non-local variable. 

If your application works with specific a data type, the number of
instances of which may vary at run time, consider using a Class module
to encapsulate then entire function of the entity into a single
module. Use properties of the class to set the values that define the
class, and use methods of the class to carry out actions.

You can think of your code base as a set of Lego blocks, each
procedure being one block. Then, you create the application as a whole
as a matter of just building up one block upon another. If you do this
consistently and do it well, you'll find that you can easily re-use
code within your project and also in other projects.  My standard
library consists of about 200 individual modules, each self-contained
and devoted to a specific task or set of tasks. and each is fully
tested. For example, if I need to access the system registry, I just
import my library's modRegistry module and then I'm done with it. No
more code to write. If I need XML functions, I just import my modXML
module and call upon its prewritten and tested functions.

Generally, a procedure in one module can call a procedure in any other
module. Unless the method is scoped as Private, it doesn't matter (as
far as the compiler goes -- organization is another question) where
the code resides. See http://www.cpearson.com/Excel/scope.aspx for an
explanation of scope and the visibility and access of  code and
variables within a project.

There is a limit to the number of lines in a procedure and to size of
a module. However, if you find yourself running up against those
limitations, then the code really needs to be restructured.

As a general rule, your code should tend to have a large number of
small procedures rather than a relatively small number of large
procedures.  If you find that your procedures are over, say, 200 lines
of code, or you find that your code does the same operations in
several locations, then you should seriously consider rewriting the
code.  

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]







On Tue, 2 Feb 2010 10:14:03 -0800, Brian
<Brian@discussions.microsoft.com> wrote:

>I have a user form with alot of code in it. As of now all the code is in the 
>Userform
>Code window, but there is so much code that it's getting confusing. I have 
>one Sub that is to large and needs to be split into several subs.
>
>When I was done I was going to break all the Subs down into different 
>modules to clean it up. I guess I will have to do that now, but I am not sure 
>how to do it.
>
>1: My question is in the UserForm Code Window how do I refer to a module?
>2: If the Code is to large can one Module call another module?
>    Something like User form Code calls Module 1 and at the end of module 1 
>code, it calls for module 2, etc....
>3: Most of my Code is With statements / End With then more code. 
>
>
>Here is an Example of the Code in the UserForm Code Window:
>Private Sub Update_Installer_Forms_10_Click()
> 
>   With Workbooks("Master Installer Forms.xlsm").Sheets("Install Pack Con")
>              **Code for the sub is here**
>           End With
> 
>    With Workbooks("Master Installer Forms.xlsm").Sheets("Install Chk List")
>              **Code for the sub is here**
>            End With
>
>End Sub
>
>I really need to sort this out so it's not so confusing to work on. Can 
>anyone please help me or explain it in english to me. 
0
Chip
2/2/2010 7:16:17 PM
I was hoping to make all the modules Private Sub. I do not want them being 
changed after I am done.

All the subs in the User Form are are Private. Can I just cut and paste them 
into a module and then in User Code Window call that Sub. 

        Private Sub Update_Installer_Forms_10_Click()
            Call Update_Installer_Forms_10_Click()       'Macro1 located in 
Module1
        End Sub


"JLGWhiz" wrote:

> Hi Brian,
> 
> 1: My question is in the UserForm Code Window how do I refer to a module?
> 
> A1:  You can call any procedure that is in the public modules (Module1, 
> Mocule2, etc.) from the UserForm code module.  If you are using event code 
> to respond to some user's interaction, then in the event code you would call 
> the working procedure out of the public module:
> 
>      Private Sub Listbox1_Click()
>            Call Macro1       'Macro1 located in Module1
>     End Sub
> 
> 2: If the Code is to large can one Module call another module?
>     Something like User form Code calls Module 1 and at the end of module 1
> code, it calls for module 2, etc...
> 
>    A2:  Yes, any public module can call from and respond to any other public 
> module.
> ..
> 3: Most of my Code is With statements / End With then more code.
> 
>     A3:  So?  That is just a style of writing code.  I do not believe it 
> would influence whether the code can be called from another module or not.
> 
> As a general rule, private procedures can call any public procedure, but the 
> reverse is not necessarily true.
> 
> 
> "Brian" <Brian@discussions.microsoft.com> wrote in message 
> news:260E2CF1-1B0E-4444-AAE8-0F200427B42C@microsoft.com...
> >I have a user form with alot of code in it. As of now all the code is in 
> >the
> > Userform
> > Code window, but there is so much code that it's getting confusing. I have
> > one Sub that is to large and needs to be split into several subs.
> >
> > When I was done I was going to break all the Subs down into different
> > modules to clean it up. I guess I will have to do that now, but I am not 
> > sure
> > how to do it.
> >
> > 1: My question is in the UserForm Code Window how do I refer to a module?
> > 2: If the Code is to large can one Module call another module?
> >    Something like User form Code calls Module 1 and at the end of module 1
> > code, it calls for module 2, etc....
> > 3: Most of my Code is With statements / End With then more code.
> >
> >
> > Here is an Example of the Code in the UserForm Code Window:
> > Private Sub Update_Installer_Forms_10_Click()
> >
> >   With Workbooks("Master Installer Forms.xlsm").Sheets("Install Pack Con")
> >              **Code for the sub is here**
> >           End With
> >
> >    With Workbooks("Master Installer Forms.xlsm").Sheets("Install Chk 
> > List")
> >              **Code for the sub is here**
> >            End With
> >
> > End Sub
> >
> > I really need to sort this out so it's not so confusing to work on. Can
> > anyone please help me or explain it in english to me.
> > 
> 
> 
> .
> 
0
Utf
2/2/2010 7:29:01 PM
You have probably read Chip's narrative by now.  He paints a broader picture 
than what I got into.  However, to clarify the difference between public and 
private procedures, Public simply means that it is accessible by other code 
and can be incorporated into different procedures by call up during runtime. 
Private does not mean that other people cannot access the code.  It means 
that the code is restricted to operate within the particular object that 
holds the code, such as UserForm, ThisWorkbook or sheet modules and 
generally speaking cannot be called by a procedure outside of those objects. 
Notice that I say, generally speaking.  There are exceptions to the rule but 
I will not go into that here.  For planning purposes in designing a project, 
stick with the basic conditions of Public and Private and you will be better 
off.

You really need to get a book that explains the basics of the VBA 
conventions, although some of these things are explained in one of the 
manuals included in VBA help file.  You just have to look through it for a 
while to find the parts that give the broader explanations.  You can test a 
lot of the things you want to do and if they won't work, the worst that can 
happen is you get an error message saying you can't do that.

But here is something that might make sense to you as an engineer.  You can 
do modular programming without using a bunch of different code windows. 
Here is a form of modular programming that can all be in one code window.

   Sub Main()
        Macro1
        MsgBox "Macro1 Completed"
        Macro2
        MsgBos "Macro2 Completed"
        Macro3
        MsgBox "Program Completed"
   End Sub

   Sub Macro1()
         'Declarations
         'Variable assignment
         'Code body
    End Sub

   Sub Macro2()
         'Same pincipal as Macro1
   End Sub

   Sub Macro3()
          'Same principal as Macro1
    End Sub

The Main procedure simply calls the other 3 procedures which can perform 
completely different actions,  maybe one copies data, another sets formats 
and the other does clean-up work or opens a UserForm for user interface. 
The point is that by breaking the code into small procedures it is being 
modularized and any one of thoses separate procedures can be called in any 
order by the main procedure.  It is like taking tools out of a tool kit as 
you need them.





"Brian" <Brian@discussions.microsoft.com> wrote in message 
news:1FFBC72A-1337-45BA-8B55-949F7A43D862@microsoft.com...
>I was hoping to make all the modules Private Sub. I do not want them being
> changed after I am done.
>
> All the subs in the User Form are are Private. Can I just cut and paste 
> them
> into a module and then in User Code Window call that Sub.
>
>        Private Sub Update_Installer_Forms_10_Click()
>            Call Update_Installer_Forms_10_Click()       'Macro1 located in
> Module1
>        End Sub
>
>
> "JLGWhiz" wrote:
>
>> Hi Brian,
>>
>> 1: My question is in the UserForm Code Window how do I refer to a module?
>>
>> A1:  You can call any procedure that is in the public modules (Module1,
>> Mocule2, etc.) from the UserForm code module.  If you are using event 
>> code
>> to respond to some user's interaction, then in the event code you would 
>> call
>> the working procedure out of the public module:
>>
>>      Private Sub Listbox1_Click()
>>            Call Macro1       'Macro1 located in Module1
>>     End Sub
>>
>> 2: If the Code is to large can one Module call another module?
>>     Something like User form Code calls Module 1 and at the end of module 
>> 1
>> code, it calls for module 2, etc...
>>
>>    A2:  Yes, any public module can call from and respond to any other 
>> public
>> module.
>> ..
>> 3: Most of my Code is With statements / End With then more code.
>>
>>     A3:  So?  That is just a style of writing code.  I do not believe it
>> would influence whether the code can be called from another module or 
>> not.
>>
>> As a general rule, private procedures can call any public procedure, but 
>> the
>> reverse is not necessarily true.
>>
>>
>> "Brian" <Brian@discussions.microsoft.com> wrote in message
>> news:260E2CF1-1B0E-4444-AAE8-0F200427B42C@microsoft.com...
>> >I have a user form with alot of code in it. As of now all the code is in
>> >the
>> > Userform
>> > Code window, but there is so much code that it's getting confusing. I 
>> > have
>> > one Sub that is to large and needs to be split into several subs.
>> >
>> > When I was done I was going to break all the Subs down into different
>> > modules to clean it up. I guess I will have to do that now, but I am 
>> > not
>> > sure
>> > how to do it.
>> >
>> > 1: My question is in the UserForm Code Window how do I refer to a 
>> > module?
>> > 2: If the Code is to large can one Module call another module?
>> >    Something like User form Code calls Module 1 and at the end of 
>> > module 1
>> > code, it calls for module 2, etc....
>> > 3: Most of my Code is With statements / End With then more code.
>> >
>> >
>> > Here is an Example of the Code in the UserForm Code Window:
>> > Private Sub Update_Installer_Forms_10_Click()
>> >
>> >   With Workbooks("Master Installer Forms.xlsm").Sheets("Install Pack 
>> > Con")
>> >              **Code for the sub is here**
>> >           End With
>> >
>> >    With Workbooks("Master Installer Forms.xlsm").Sheets("Install Chk
>> > List")
>> >              **Code for the sub is here**
>> >            End With
>> >
>> > End Sub
>> >
>> > I really need to sort this out so it's not so confusing to work on. Can
>> > anyone please help me or explain it in english to me.
>> >
>>
>>
>> .
>> 


0
JLGWhiz
2/2/2010 8:21:14 PM
I would post my code on here but it's way to long. I am not sure if it would 
post?

'************************************************************
'Update Installer Forms Control Button
'Data Loaded from User Form to Installer Forms
'************************************************************
Private Sub Update_Installer_Forms_10_Click()

'Installer Package Content/Checklist Code:
       With Workbooks("Master Installer Forms.xlsm").Sheets("Install Pack 
Con")
        .Range("B03").Value = Me("CLLI_Code_1").Value
        .Range("B05").Value = Me("TEO_No_1").Value
        .Range("B07").Value = Me("Office_1").Value            
            **20 More Lines of Same Code**
    End With

With Workbooks("Master Installer Forms.xlsm").Sheets("Install Chk List")
    'Sheet 01 Code:
        .Range("D03").Value = Me("CLLI_Code_1").Value
        .Range("D05").Value = Me("TEO_No_1").Value
        .Range("D07").Value = Me("CES_No_1").Value
            **20 More Lines of Same Code**
    End With

There are at least 50 more just like this in the sub procedure and some have 
almost (50) .Range("D03").Value = Me("*****_**").Values in them. In some of 
my Subs there are between 100-600 Lines just like above.

I didn't know there was shorter way of doing this.

I do know there is so much code that it's getting confusing trying to keep 
it all sorted. LOL




"Chip Pearson" wrote:

> You have a lot of flexibility in the ways you can distribute code
> within modules. I generally organize code as follows. First, the only
> code that resides in a user form's code module is that code required
> directly by the form -- that is, event procedures for each control.
> Similarly, the only code that resides in ThisWorkbook or one of the
> Sheet module is the event handling for the object, and those
> procedures should generally just call other procedures located
> elsewhere to do the real work. Keep the core logic out of ThisWorkbook
> the sheet modules and user forms.
> 
> Everything else goes in other modules. Code is distributed amongst
> several modules based on the code's function. General utility
> functions in one module, data access functions in another, and core
> business functionality in yet another module or two. 
> 
> Procedures should be as generic as possible, allowing them to be
> called in many circumstances without changing any code. All relevant
> information should be passed in as parameters. Module- or
> Project-scoped variables should be avoided as much as possible. If a
> procedure relies on a value that is not passed in (and thus can be
> modified by other code), you run the risk of unintentional side
> effects that arise when you change a seemingly unrelated procedure
> that modifies a non-parameter or non-local variable. 
> 
> If your application works with specific a data type, the number of
> instances of which may vary at run time, consider using a Class module
> to encapsulate then entire function of the entity into a single
> module. Use properties of the class to set the values that define the
> class, and use methods of the class to carry out actions.
> 
> You can think of your code base as a set of Lego blocks, each
> procedure being one block. Then, you create the application as a whole
> as a matter of just building up one block upon another. If you do this
> consistently and do it well, you'll find that you can easily re-use
> code within your project and also in other projects.  My standard
> library consists of about 200 individual modules, each self-contained
> and devoted to a specific task or set of tasks. and each is fully
> tested. For example, if I need to access the system registry, I just
> import my library's modRegistry module and then I'm done with it. No
> more code to write. If I need XML functions, I just import my modXML
> module and call upon its prewritten and tested functions.
> 
> Generally, a procedure in one module can call a procedure in any other
> module. Unless the method is scoped as Private, it doesn't matter (as
> far as the compiler goes -- organization is another question) where
> the code resides. See http://www.cpearson.com/Excel/scope.aspx for an
> explanation of scope and the visibility and access of  code and
> variables within a project.
> 
> There is a limit to the number of lines in a procedure and to size of
> a module. However, if you find yourself running up against those
> limitations, then the code really needs to be restructured.
> 
> As a general rule, your code should tend to have a large number of
> small procedures rather than a relatively small number of large
> procedures.  If you find that your procedures are over, say, 200 lines
> of code, or you find that your code does the same operations in
> several locations, then you should seriously consider rewriting the
> code.  
> 
> Cordially,
> Chip Pearson
> Microsoft MVP 1998 - 2010
> Pearson Software Consulting, LLC
> www.cpearson.com
> [email on web site]
> 
> 
> 
> 
> 
> 
> 
> On Tue, 2 Feb 2010 10:14:03 -0800, Brian
> <Brian@discussions.microsoft.com> wrote:
> 
> >I have a user form with alot of code in it. As of now all the code is in the 
> >Userform
> >Code window, but there is so much code that it's getting confusing. I have 
> >one Sub that is to large and needs to be split into several subs.
> >
> >When I was done I was going to break all the Subs down into different 
> >modules to clean it up. I guess I will have to do that now, but I am not sure 
> >how to do it.
> >
> >1: My question is in the UserForm Code Window how do I refer to a module?
> >2: If the Code is to large can one Module call another module?
> >    Something like User form Code calls Module 1 and at the end of module 1 
> >code, it calls for module 2, etc....
> >3: Most of my Code is With statements / End With then more code. 
> >
> >
> >Here is an Example of the Code in the UserForm Code Window:
> >Private Sub Update_Installer_Forms_10_Click()
> > 
> >   With Workbooks("Master Installer Forms.xlsm").Sheets("Install Pack Con")
> >              **Code for the sub is here**
> >           End With
> > 
> >    With Workbooks("Master Installer Forms.xlsm").Sheets("Install Chk List")
> >              **Code for the sub is here**
> >            End With
> >
> >End Sub
> >
> >I really need to sort this out so it's not so confusing to work on. Can 
> >anyone please help me or explain it in english to me. 
> .
> 
0
Utf
2/2/2010 8:22:23 PM
P.S.  If you need to call an event procedure from outside its host object 
(i.e. UserForm or Sheet) then you probably did not need an event procedure 
to begin with.  It should have been written as a public Sub procedure and 
then called by the event code if needed for the event, instead of the 
reverse of trying to call an event procedure from a public code window.


"Brian" <Brian@discussions.microsoft.com> wrote in message 
news:1FFBC72A-1337-45BA-8B55-949F7A43D862@microsoft.com...
>I was hoping to make all the modules Private Sub. I do not want them being
> changed after I am done.
>
> All the subs in the User Form are are Private. Can I just cut and paste 
> them
> into a module and then in User Code Window call that Sub.
>
>        Private Sub Update_Installer_Forms_10_Click()
>            Call Update_Installer_Forms_10_Click()       'Macro1 located in
> Module1
>        End Sub
>
>
> "JLGWhiz" wrote:
>
>> Hi Brian,
>>
>> 1: My question is in the UserForm Code Window how do I refer to a module?
>>
>> A1:  You can call any procedure that is in the public modules (Module1,
>> Mocule2, etc.) from the UserForm code module.  If you are using event 
>> code
>> to respond to some user's interaction, then in the event code you would 
>> call
>> the working procedure out of the public module:
>>
>>      Private Sub Listbox1_Click()
>>            Call Macro1       'Macro1 located in Module1
>>     End Sub
>>
>> 2: If the Code is to large can one Module call another module?
>>     Something like User form Code calls Module 1 and at the end of module 
>> 1
>> code, it calls for module 2, etc...
>>
>>    A2:  Yes, any public module can call from and respond to any other 
>> public
>> module.
>> ..
>> 3: Most of my Code is With statements / End With then more code.
>>
>>     A3:  So?  That is just a style of writing code.  I do not believe it
>> would influence whether the code can be called from another module or 
>> not.
>>
>> As a general rule, private procedures can call any public procedure, but 
>> the
>> reverse is not necessarily true.
>>
>>
>> "Brian" <Brian@discussions.microsoft.com> wrote in message
>> news:260E2CF1-1B0E-4444-AAE8-0F200427B42C@microsoft.com...
>> >I have a user form with alot of code in it. As of now all the code is in
>> >the
>> > Userform
>> > Code window, but there is so much code that it's getting confusing. I 
>> > have
>> > one Sub that is to large and needs to be split into several subs.
>> >
>> > When I was done I was going to break all the Subs down into different
>> > modules to clean it up. I guess I will have to do that now, but I am 
>> > not
>> > sure
>> > how to do it.
>> >
>> > 1: My question is in the UserForm Code Window how do I refer to a 
>> > module?
>> > 2: If the Code is to large can one Module call another module?
>> >    Something like User form Code calls Module 1 and at the end of 
>> > module 1
>> > code, it calls for module 2, etc....
>> > 3: Most of my Code is With statements / End With then more code.
>> >
>> >
>> > Here is an Example of the Code in the UserForm Code Window:
>> > Private Sub Update_Installer_Forms_10_Click()
>> >
>> >   With Workbooks("Master Installer Forms.xlsm").Sheets("Install Pack 
>> > Con")
>> >              **Code for the sub is here**
>> >           End With
>> >
>> >    With Workbooks("Master Installer Forms.xlsm").Sheets("Install Chk
>> > List")
>> >              **Code for the sub is here**
>> >            End With
>> >
>> > End Sub
>> >
>> > I really need to sort this out so it's not so confusing to work on. Can
>> > anyone please help me or explain it in english to me.
>> >
>>
>>
>> .
>> 


0
JLGWhiz
2/2/2010 8:25:20 PM
Lets say I take a really big Sub Procedure that is in the User Form Code 
Window and break it down into 6 smaller subs and put the 6 subs into a module.

Now I have 6 Small Subs sitting there in a module. In place of the Big Sub 
Procedure can I put a call statement there to call the Smaller Subs?

Can I just call the entire module to run or do I need to call each Smaller 
Sub to run 1 at a time. I assume they will run in the order they are in. Is 
this the same as example you gave me?  

Module1
      Sub1
      Sub2
      Sub3


Located in the Main User Form Code Window
-----------------------------------------------------
Sub Main()
        Macro1
        MsgBox "Macro1 Completed"
        Macro2
        MsgBos "Macro2 Completed"
        Macro3
        MsgBox "Program Completed"
   End Sub


Located in the Module
-------------------------------------------
   Sub Macro1()
         'Declarations
         'Variable assignment
         'Code body
    End Sub

   Sub Macro2()
         'Same pincipal as Macro1
   End Sub

   Sub Macro3()
          'Same principal as Macro1
    End Sub

Did I get it correct or am I still missing something?









"JLGWhiz" wrote:

> P.S.  If you need to call an event procedure from outside its host object 
> (i.e. UserForm or Sheet) then you probably did not need an event procedure 
> to begin with.  It should have been written as a public Sub procedure and 
> then called by the event code if needed for the event, instead of the 
> reverse of trying to call an event procedure from a public code window.
> 
> 
> "Brian" <Brian@discussions.microsoft.com> wrote in message 
> news:1FFBC72A-1337-45BA-8B55-949F7A43D862@microsoft.com...
> >I was hoping to make all the modules Private Sub. I do not want them being
> > changed after I am done.
> >
> > All the subs in the User Form are are Private. Can I just cut and paste 
> > them
> > into a module and then in User Code Window call that Sub.
> >
> >        Private Sub Update_Installer_Forms_10_Click()
> >            Call Update_Installer_Forms_10_Click()       'Macro1 located in
> > Module1
> >        End Sub
> >
> >
> > "JLGWhiz" wrote:
> >
> >> Hi Brian,
> >>
> >> 1: My question is in the UserForm Code Window how do I refer to a module?
> >>
> >> A1:  You can call any procedure that is in the public modules (Module1,
> >> Mocule2, etc.) from the UserForm code module.  If you are using event 
> >> code
> >> to respond to some user's interaction, then in the event code you would 
> >> call
> >> the working procedure out of the public module:
> >>
> >>      Private Sub Listbox1_Click()
> >>            Call Macro1       'Macro1 located in Module1
> >>     End Sub
> >>
> >> 2: If the Code is to large can one Module call another module?
> >>     Something like User form Code calls Module 1 and at the end of module 
> >> 1
> >> code, it calls for module 2, etc...
> >>
> >>    A2:  Yes, any public module can call from and respond to any other 
> >> public
> >> module.
> >> ..
> >> 3: Most of my Code is With statements / End With then more code.
> >>
> >>     A3:  So?  That is just a style of writing code.  I do not believe it
> >> would influence whether the code can be called from another module or 
> >> not.
> >>
> >> As a general rule, private procedures can call any public procedure, but 
> >> the
> >> reverse is not necessarily true.
> >>
> >>
> >> "Brian" <Brian@discussions.microsoft.com> wrote in message
> >> news:260E2CF1-1B0E-4444-AAE8-0F200427B42C@microsoft.com...
> >> >I have a user form with alot of code in it. As of now all the code is in
> >> >the
> >> > Userform
> >> > Code window, but there is so much code that it's getting confusing. I 
> >> > have
> >> > one Sub that is to large and needs to be split into several subs.
> >> >
> >> > When I was done I was going to break all the Subs down into different
> >> > modules to clean it up. I guess I will have to do that now, but I am 
> >> > not
> >> > sure
> >> > how to do it.
> >> >
> >> > 1: My question is in the UserForm Code Window how do I refer to a 
> >> > module?
> >> > 2: If the Code is to large can one Module call another module?
> >> >    Something like User form Code calls Module 1 and at the end of 
> >> > module 1
> >> > code, it calls for module 2, etc....
> >> > 3: Most of my Code is With statements / End With then more code.
> >> >
> >> >
> >> > Here is an Example of the Code in the UserForm Code Window:
> >> > Private Sub Update_Installer_Forms_10_Click()
> >> >
> >> >   With Workbooks("Master Installer Forms.xlsm").Sheets("Install Pack 
> >> > Con")
> >> >              **Code for the sub is here**
> >> >           End With
> >> >
> >> >    With Workbooks("Master Installer Forms.xlsm").Sheets("Install Chk
> >> > List")
> >> >              **Code for the sub is here**
> >> >            End With
> >> >
> >> > End Sub
> >> >
> >> > I really need to sort this out so it's not so confusing to work on. Can
> >> > anyone please help me or explain it in english to me.
> >> >
> >>
> >>
> >> .
> >> 
> 
> 
> .
> 
0
Utf
2/2/2010 9:27:01 PM
The core answer to all of your questions is really that it depends on what 
you put into the code as to what it will do.  The programmer is in control 
and the processor is only as smart as the programmer.

If you have six sub procedures in module1, you can use other code to call 
those six procedures in any order you wish to call them in.  However, if you 
have written those procedures in a fashion that make one reliant upon 
another, then you would need to run those in a specific order to get the 
desired results.  Otherwise, they can run independently and in any order.

Terminology is important.  When I refer to calling a procedure, I mean that 
a line of code initiates a procedure.  That line of code is simply the 
procedure name.  If a procedure is named myMacro and it has no variable 
arguments in the title line of the procedure, then all that is needed to 
call it is the name:

    myMacro

That will initiate that procedure.  If the procedure has arguments then it 
would be called:

    Call myMacro("arg1")

The conventions are in the VBA help file for calling procedures.

The same six procedures can be manually initiated individually by assigning 
keyboard shortcuts to them, or assigning them to individual command buttons. 
Like Chip said, a lot of flexibility when they are in the public module.

What you cannot do is run an event procedure from the public module while it 
has the event code title line.  That means that:

Private Sub CommandButton1_Click()
    'some code here
End Sub

would not run.  You will hear a beep.  At least my computer beeps if I try 
it.
Any event code must be executed from an appropriate code window. 
Worksheet_Change from a worksheet code module, Workbooks_Open from the 
ThisWorkbook code module, UserForm_Initialize from a UserForm code module. 
The internal operation of the VBA compiler is geared to ignore these title 
lines if they are not in the appropriate code module, but it will beep to 
let you know that something is not right.  I don't know why they did not 
make an error message for that.











"Brian" <Brian@discussions.microsoft.com> wrote in message 
news:FDC3677F-D1BB-47A1-A8CB-38FD17E1A6EC@microsoft.com...
> Lets say I take a really big Sub Procedure that is in the User Form Code
> Window and break it down into 6 smaller subs and put the 6 subs into a 
> module.
>
> Now I have 6 Small Subs sitting there in a module. In place of the Big Sub
> Procedure can I put a call statement there to call the Smaller Subs?
>
> Can I just call the entire module to run or do I need to call each Smaller
> Sub to run 1 at a time. I assume they will run in the order they are in. 
> Is
> this the same as example you gave me?
>
> Module1
>      Sub1
>      Sub2
>      Sub3
>
>
> Located in the Main User Form Code Window
> -----------------------------------------------------
> Sub Main()
>        Macro1
>        MsgBox "Macro1 Completed"
>        Macro2
>        MsgBos "Macro2 Completed"
>        Macro3
>        MsgBox "Program Completed"
>   End Sub
>
>
> Located in the Module
> -------------------------------------------
>   Sub Macro1()
>         'Declarations
>         'Variable assignment
>         'Code body
>    End Sub
>
>   Sub Macro2()
>         'Same pincipal as Macro1
>   End Sub
>
>   Sub Macro3()
>          'Same principal as Macro1
>    End Sub
>
> Did I get it correct or am I still missing something?
>
>
>
>
>
>
>
>
>
> "JLGWhiz" wrote:
>
>> P.S.  If you need to call an event procedure from outside its host object
>> (i.e. UserForm or Sheet) then you probably did not need an event 
>> procedure
>> to begin with.  It should have been written as a public Sub procedure and
>> then called by the event code if needed for the event, instead of the
>> reverse of trying to call an event procedure from a public code window.
>>
>>
>> "Brian" <Brian@discussions.microsoft.com> wrote in message
>> news:1FFBC72A-1337-45BA-8B55-949F7A43D862@microsoft.com...
>> >I was hoping to make all the modules Private Sub. I do not want them 
>> >being
>> > changed after I am done.
>> >
>> > All the subs in the User Form are are Private. Can I just cut and paste
>> > them
>> > into a module and then in User Code Window call that Sub.
>> >
>> >        Private Sub Update_Installer_Forms_10_Click()
>> >            Call Update_Installer_Forms_10_Click()       'Macro1 located 
>> > in
>> > Module1
>> >        End Sub
>> >
>> >
>> > "JLGWhiz" wrote:
>> >
>> >> Hi Brian,
>> >>
>> >> 1: My question is in the UserForm Code Window how do I refer to a 
>> >> module?
>> >>
>> >> A1:  You can call any procedure that is in the public modules 
>> >> (Module1,
>> >> Mocule2, etc.) from the UserForm code module.  If you are using event
>> >> code
>> >> to respond to some user's interaction, then in the event code you 
>> >> would
>> >> call
>> >> the working procedure out of the public module:
>> >>
>> >>      Private Sub Listbox1_Click()
>> >>            Call Macro1       'Macro1 located in Module1
>> >>     End Sub
>> >>
>> >> 2: If the Code is to large can one Module call another module?
>> >>     Something like User form Code calls Module 1 and at the end of 
>> >> module
>> >> 1
>> >> code, it calls for module 2, etc...
>> >>
>> >>    A2:  Yes, any public module can call from and respond to any other
>> >> public
>> >> module.
>> >> ..
>> >> 3: Most of my Code is With statements / End With then more code.
>> >>
>> >>     A3:  So?  That is just a style of writing code.  I do not believe 
>> >> it
>> >> would influence whether the code can be called from another module or
>> >> not.
>> >>
>> >> As a general rule, private procedures can call any public procedure, 
>> >> but
>> >> the
>> >> reverse is not necessarily true.
>> >>
>> >>
>> >> "Brian" <Brian@discussions.microsoft.com> wrote in message
>> >> news:260E2CF1-1B0E-4444-AAE8-0F200427B42C@microsoft.com...
>> >> >I have a user form with alot of code in it. As of now all the code is 
>> >> >in
>> >> >the
>> >> > Userform
>> >> > Code window, but there is so much code that it's getting confusing. 
>> >> > I
>> >> > have
>> >> > one Sub that is to large and needs to be split into several subs.
>> >> >
>> >> > When I was done I was going to break all the Subs down into 
>> >> > different
>> >> > modules to clean it up. I guess I will have to do that now, but I am
>> >> > not
>> >> > sure
>> >> > how to do it.
>> >> >
>> >> > 1: My question is in the UserForm Code Window how do I refer to a
>> >> > module?
>> >> > 2: If the Code is to large can one Module call another module?
>> >> >    Something like User form Code calls Module 1 and at the end of
>> >> > module 1
>> >> > code, it calls for module 2, etc....
>> >> > 3: Most of my Code is With statements / End With then more code.
>> >> >
>> >> >
>> >> > Here is an Example of the Code in the UserForm Code Window:
>> >> > Private Sub Update_Installer_Forms_10_Click()
>> >> >
>> >> >   With Workbooks("Master Installer Forms.xlsm").Sheets("Install Pack
>> >> > Con")
>> >> >              **Code for the sub is here**
>> >> >           End With
>> >> >
>> >> >    With Workbooks("Master Installer Forms.xlsm").Sheets("Install Chk
>> >> > List")
>> >> >              **Code for the sub is here**
>> >> >            End With
>> >> >
>> >> > End Sub
>> >> >
>> >> > I really need to sort this out so it's not so confusing to work on. 
>> >> > Can
>> >> > anyone please help me or explain it in english to me.
>> >> >
>> >>
>> >>
>> >> .
>> >>
>>
>>
>> .
>> 


0
JLGWhiz
2/3/2010 12:42:44 AM
copy all of the code below to a public code module, thin run Sub Main()

Sub Main()
   proc1
   proc2
   proc3
   proc1
   MsgBox "Notice that proc1 ran twice"
End Sub

Sub proc1()
   x = InputBox("Enter a name", "NAME")
   MsgBox x & " was entered for a name."
End Sub

Sub proc2()
   MsgBox "This is second procedure"
End Sub

Sub proc3()
   MsgBox "This is third procedure"
End Sub






"Brian" <Brian@discussions.microsoft.com> wrote in message 
news:FDC3677F-D1BB-47A1-A8CB-38FD17E1A6EC@microsoft.com...
> Lets say I take a really big Sub Procedure that is in the User Form Code
> Window and break it down into 6 smaller subs and put the 6 subs into a 
> module.
>
> Now I have 6 Small Subs sitting there in a module. In place of the Big Sub
> Procedure can I put a call statement there to call the Smaller Subs?
>
> Can I just call the entire module to run or do I need to call each Smaller
> Sub to run 1 at a time. I assume they will run in the order they are in. 
> Is
> this the same as example you gave me?
>
> Module1
>      Sub1
>      Sub2
>      Sub3
>
>
> Located in the Main User Form Code Window
> -----------------------------------------------------
> Sub Main()
>        Macro1
>        MsgBox "Macro1 Completed"
>        Macro2
>        MsgBos "Macro2 Completed"
>        Macro3
>        MsgBox "Program Completed"
>   End Sub
>
>
> Located in the Module
> -------------------------------------------
>   Sub Macro1()
>         'Declarations
>         'Variable assignment
>         'Code body
>    End Sub
>
>   Sub Macro2()
>         'Same pincipal as Macro1
>   End Sub
>
>   Sub Macro3()
>          'Same principal as Macro1
>    End Sub
>
> Did I get it correct or am I still missing something?
>
>
>
>
>
>
>
>
>
> "JLGWhiz" wrote:
>
>> P.S.  If you need to call an event procedure from outside its host object
>> (i.e. UserForm or Sheet) then you probably did not need an event 
>> procedure
>> to begin with.  It should have been written as a public Sub procedure and
>> then called by the event code if needed for the event, instead of the
>> reverse of trying to call an event procedure from a public code window.
>>
>>
>> "Brian" <Brian@discussions.microsoft.com> wrote in message
>> news:1FFBC72A-1337-45BA-8B55-949F7A43D862@microsoft.com...
>> >I was hoping to make all the modules Private Sub. I do not want them 
>> >being
>> > changed after I am done.
>> >
>> > All the subs in the User Form are are Private. Can I just cut and paste
>> > them
>> > into a module and then in User Code Window call that Sub.
>> >
>> >        Private Sub Update_Installer_Forms_10_Click()
>> >            Call Update_Installer_Forms_10_Click()       'Macro1 located 
>> > in
>> > Module1
>> >        End Sub
>> >
>> >
>> > "JLGWhiz" wrote:
>> >
>> >> Hi Brian,
>> >>
>> >> 1: My question is in the UserForm Code Window how do I refer to a 
>> >> module?
>> >>
>> >> A1:  You can call any procedure that is in the public modules 
>> >> (Module1,
>> >> Mocule2, etc.) from the UserForm code module.  If you are using event
>> >> code
>> >> to respond to some user's interaction, then in the event code you 
>> >> would
>> >> call
>> >> the working procedure out of the public module:
>> >>
>> >>      Private Sub Listbox1_Click()
>> >>            Call Macro1       'Macro1 located in Module1
>> >>     End Sub
>> >>
>> >> 2: If the Code is to large can one Module call another module?
>> >>     Something like User form Code calls Module 1 and at the end of 
>> >> module
>> >> 1
>> >> code, it calls for module 2, etc...
>> >>
>> >>    A2:  Yes, any public module can call from and respond to any other
>> >> public
>> >> module.
>> >> ..
>> >> 3: Most of my Code is With statements / End With then more code.
>> >>
>> >>     A3:  So?  That is just a style of writing code.  I do not believe 
>> >> it
>> >> would influence whether the code can be called from another module or
>> >> not.
>> >>
>> >> As a general rule, private procedures can call any public procedure, 
>> >> but
>> >> the
>> >> reverse is not necessarily true.
>> >>
>> >>
>> >> "Brian" <Brian@discussions.microsoft.com> wrote in message
>> >> news:260E2CF1-1B0E-4444-AAE8-0F200427B42C@microsoft.com...
>> >> >I have a user form with alot of code in it. As of now all the code is 
>> >> >in
>> >> >the
>> >> > Userform
>> >> > Code window, but there is so much code that it's getting confusing. 
>> >> > I
>> >> > have
>> >> > one Sub that is to large and needs to be split into several subs.
>> >> >
>> >> > When I was done I was going to break all the Subs down into 
>> >> > different
>> >> > modules to clean it up. I guess I will have to do that now, but I am
>> >> > not
>> >> > sure
>> >> > how to do it.
>> >> >
>> >> > 1: My question is in the UserForm Code Window how do I refer to a
>> >> > module?
>> >> > 2: If the Code is to large can one Module call another module?
>> >> >    Something like User form Code calls Module 1 and at the end of
>> >> > module 1
>> >> > code, it calls for module 2, etc....
>> >> > 3: Most of my Code is With statements / End With then more code.
>> >> >
>> >> >
>> >> > Here is an Example of the Code in the UserForm Code Window:
>> >> > Private Sub Update_Installer_Forms_10_Click()
>> >> >
>> >> >   With Workbooks("Master Installer Forms.xlsm").Sheets("Install Pack
>> >> > Con")
>> >> >              **Code for the sub is here**
>> >> >           End With
>> >> >
>> >> >    With Workbooks("Master Installer Forms.xlsm").Sheets("Install Chk
>> >> > List")
>> >> >              **Code for the sub is here**
>> >> >            End With
>> >> >
>> >> > End Sub
>> >> >
>> >> > I really need to sort this out so it's not so confusing to work on. 
>> >> > Can
>> >> > anyone please help me or explain it in english to me.
>> >> >
>> >>
>> >>
>> >> .
>> >>
>>
>>
>> .
>> 


0
JLGWhiz
2/3/2010 12:54:43 AM
Reply:

Similar Artilces:

Thread Question #2
Dear Sir, In my application we are using legacy libraries which are not thread safe.We are calling one function from the GUI to initiate the process which will call the function in the libraries.The process is as follows : 1) The tool requests the data from the oracle and after retrieving the data from the oracle local system creates one file based on this data,This process is continued repetitively based on the input,that means it may create n files based on the input.To improve the performance we are using two threads,one thread calls the library function(the constraint is we hav...

user created shapes non printing
I started have a problem with vision 2002 that I have not noticed before. When I create a new shape, by default, it assumes the non-printing properly under FORMAT � BEHAVIOR. Also if I group a set of "printing" shapes the group will become non-printing. Can I change this behavior? How are you creating the new shape? Also are you using layers in your document? -- Mark Nelson Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. "Robert" <hammer_757@hotmail.com> wrote in message news:9ec427f7.0409231005.576...

Updating a table from Form Entry
I have a form that pops up when a user clicks a button to Print said form. The form is for the user to enter the name of the table and any footnotes for that particular form, this form is connected to a table that stores this information for everytime the report is printed. THe problem I having is that when the user enters the information and clicks [PRINT] the report is blank, when I open the table the info the user has entered has not updated onto the table yet. Is there a way so that when the user clicks [PRINT] the footnote table will update BEFORE the report prints? Larry -- Neve...

Update textbox on form
The following are events on two combo boxes on a subform "NewJobsSubform", the first sets the rowsource of the second and also sets a default value in the second. The second event sets the value in the text box "Sell" to the price associated with the RepProduct in cboRepProduct - collected from the table "RepairProducts". "Private Sub cboCatName_AfterUpdate() On Error Resume Next Me.cboRepProduct.RowSource = "SELECT RepairProduct.RepProduct FROM" & _ " RepairProduct WHERE CatName = '" & Me.cboCatName.Value...

VB code for Macro
I have set up a rule on my InBox to check for specific words and move emails to my Work folder. Now I review emials in my Work folder and drag and drop them into 1 of 4 folders based on a number 1-4. After clicking on the folder, I need to perform the following on each of the four folders: Click on first email in the folder Clt+A (to select all the emails in the folder) Ctl+C (to copy) Drag the selections to a folder name HH Click #_Button (customized button set to send an email) Ctl+v (to paste the contents in the body of the email) Click Send Steps without the comments: Click folde...

Module name in
Hi, when your are in the EXCEL code editor, you have on your left the name of the modules. I find anoying the fact of having to remember the module name or edit one by one each modules to find for intense a piece of code as a reference. Is there a better way to do it in that environment like renaming the module with specific name? Thank's ahead!. You can rename the module. Most of the people here probably group their macros into similar function macros in different modules, and name the module accordingly. This makes it much simpler to find. You can also do a find, Ctrl-F, and set the ...

Forms Based Authentication
I have configured Exchange 2003 Server on Windows 2003 Server. Everything works , HTTP,HTTPS, OWA Password change , but whenever I enable forms based authentication I recieve an error "440 login timeout" and the page will not load. Pls Help Regards I hesitate, because it doesn't fully match your diagnosis but take a look at: http://support.microsoft.com/default.aspx?scid=kb;en- us;817379 to see if it's of any help. >-----Original Message----- >I have configured Exchange 2003 Server on Windows 2003 Server. Everything >works , HTTP,HTTPS, OWA Password change ,...

Process all cells in a (user) selection
I am using this code to give me cell by cell access to a code defined selection; Dim aCell As Range For Each aCell In Sheet4.Range("A4:A34") ' Do Stuff Here Next aCell which processes every cell in the A4:A34 Range How do I do the same thing for a selection drawn by the user before pressing my 'Process' button ? Thanks On 05 May 2010 11:10:21 GMT, Isis <isissoft@NOSPAMbtinternet.com> wrote: >I am using this code to give me cell by cell access to a code defined >selection; > >Dim aCell As Range >For Each aCell In S...

"All users" "Programs" create/modify shortcut from app...
Hi all, I've created two shortcuts into "Programs" folder for "All Users" It lets me to get them available for all user. The problem: Application running in "User" context needs to delete and re-create such links but it fails due to an "access denied" ... Settings correct permission to such links it starts working as well I've created links using the IShellLink/IPersistFile sehll interfaces. So, I actually need to have link under "programs" for "All Users" which might be modified by application running in "Users"...

No email stationery when through code
Hi I am creating email via code from access using below; Dim objOutlook As Outlook.Application Dim objOutlookMsg As Outlook.MailItem Set objOutlook = CreateObject("Outlook.Application") Set objOutlookMsg = objOutlook.CreateItem(olMailItem) objOutlookMsg.To = "recepient@mydomain.com" objOutlookMsg.Subject = "Email Subject" objOutlookMsg.Body = "Dear abc..." objOutlookMsg.Display The problem is that the default signature that is set in outlook doe snot come up in the email. How can I fix it? Thanks Regards Am Sun, 17 Sep 2006 21:11:45 +0100 schri...

How to view the code for excel built-in functions?
Is it possible? -For example the function PMT(). thanks. No, the code is compiled, so it would likely be less than useful anyway. About the best you can do is check out the equations used in Help (see "PV"). In article <OSU3OXOBGHA.1676@TK2MSFTNGP09.phx.gbl>, "serdar" <s@s.com> wrote: > Is it possible? -For example the function PMT(). > thanks. ...

Excel question #9
Is there a way that I can transpose the order of the values in a cell? For example I have the values of 10.200.13.1 in a cell and I want to transpose(not sure if that is the correct term or not) the order of the values in the cell so that they appear as 1.13.200.10. thanks for any help as I have literally 4 pages of these kind of values that I have to flip. -- Brian blanktree at hotmail dot com Hi try the following user defined function from John Walkenbach's book Excel 2000 formulas (great resource by the way): Option Explicit Function REVERSETEXT(text) As String ' R...

User status in Sharepoint 3.0
I see there is a user status that works with Office Communicator. Is there away to do this with out office Communicator or free software to do this? We are a small company with about 10 users. Nothing I'm aware of. This is built in integration with the OCS platform. -- Daniel A. Galant Imagine what we could be... if we could just imagine. "todd" <todd@discussions.microsoft.com> wrote in message news:089333D7-F0D4-4994-87E3-74A387AE33D0@microsoft.com... > I see there is a user status that works with Office Communicator. Is > there > away to...

Please help with last formula for order form.
I am able to accomplish this with 1 column by the formulas below. Cell H160 is the subtotal: =IF(SUM(H72:H111)>0,SUM(H72:H111),"") Cell H166 the total: =IF(SUM(H160)>0,SUM((H160*H163)+H160),"") Cell H163 is for Tax. I am almost finished creating an order form. I would like to get the SUM of 3 different columns that are separated. I am not able auto fill strait down the column, because the information is separated in groups with titles, and the cells are not identically sized. I tried varations of this formula: =IF(SUM(H72:H111)+(116:131)+(135:154)>0,SUM ((H72:H...

Newbie Cell Reference Question...
Hello, I apologize if this question has been answered before, but I'm no quite sure what to search for as I'm not very good with excel. I'm making a spreadsheet where one sheet references another. I'll tr to explain this as best as possible.... I'm creating a spreadsheet for a fantasy basketball league. I have "Data" sheet that contains data for all players. I have another sheet "Teams" that has all the players on each team. Column B contains th players name, and column C contains a number that corresponds to th row this player is on in the dat...

List box with available queries question
I have a list box control on a form and want the list box to display all the queries within the database. The following code is what I have so far but it does not work. Any help is appreciated. SELECT [Name] FROM MSysObjects WHERE [TYPE] = 5 and LEFT([Name],1) <> "-" ORDER BY [Name]; "Billy B" <BillyB@discussions.microsoft.com> wrote in message news:F47BB77B-7B66-4860-8954-F4FE32FE7C3C@microsoft.com... >I have a list box control on a form and want the list box to display all >the > queries within the database. The following code is what...

Compile Error in hidden module: Autoexec #2
I need help when ever I opepen or close any office product ( excel , word etc...) I get the message shown above.... How do I fix it please help ag Take a look at this: http://support.microsoft.com/default.aspx?scid=kb;EN-US;q307410 HTH Anders Silven "Ash" <ashrafg@sympatico.ca> skrev i meddelandet news:1574f01c446a0$4b5db2c0$a501280a@phx.gbl... > I need help when ever I opepen or close any office > product ( excel , word etc...) I get the message shown > above.... How do I fix it please help > > ag ...

can't find form
i have a command button on a form [frmMainMenu] that when clicked, closes that form and opens another [frmFixtureSchedulePrintOptions]. The 2 share the same table as a record source, so i'm doing this to avoid conflicting updates the code behind [frmMainMenu] reads like this (below), and functions correctly DoCmd.Close stDocName = "frmFixtureSchedulePrintOptions" DoCmd.OpenForm stDocName, acNormal on the new form [frmFixtureSchedulePrintOptions], there is a command button to save to close itself, and open the previous from [frmMainMenu], and the ...

xsd question #5
I am doing a bulk load and an element name in the xsd and xml is named differently in the database. I can NOT change the database field or xml. Can I do anything with ehw XSD? The field name in the db is "CaseType" <xs:schema xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sql="urn:schemas-microsoft-com:mapping-schema"> <xs:element name="Cases" sql:relation="PUCCASES"> <xs:complexType> <xs:sequence> <xs:element name="NbrOfCases" type="xs:decimal"/> <xs:ele...

uploading 2 or more mailboxes on 1 user account
I was able to reconnect 1 mailbox to 1 user account, but what i' looking is the way wherein i can reconnect 2 or more mailboxes into user account because instead of giving a 1:1 user account to eac person we will be replacing it and giving them an account per area Hence they already have their own personal account we will b deleting it; How can i put all their messages from their persona account into the single account that we wil be giving to them Hi, More than one mailbox per account is not possible in Exchange 200x. You can do that with Exchange 5.x Regards, -- Menko den Ouden ...

extraction code from celd
Hi :) I have a Excel problem :confused: MY QUESTION IS: if A5 = "JhoN FreD SmitH ChonG then A6 = "JNFDSHCG" I would like have got solution ;) please !!! thank you ver much nando4000@latinmail.co ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com You could create a User Defined Function: '=============================== Function GetCode(rng As Range) As String Dim i As Integer Dim str As String i = Len(rng.Value) For i = 1 To i str = Mid(rn...

Form Summarys
I want to know if i can write up my form on excel and then on anothe sheet it summarizes it so i have a log of all the forms i send out bu each time i create a new form can it create a new summary underneat the old one ?? Many Thanks:D Ben -- Message posted from http://www.ExcelForum.com Does this mean that you have certain cells that you want to track? If yes, then you could run a macro when you're done with the form: Option Explicit Option Base 0 Sub testme01() Dim myCellAddresses As Variant Dim FormWks As Worksheet Dim LogWks As Worksheet Dim nextRow As Long D...

Don't know where else to put q's. 2 questions. 11g Dongle and wire
What is and Acer WLAN 11g USB Dongle? It is some program that is on my computer and pops-up at start-up. I'v double clicked it, and nothing happens. I went on Acers site, and I can find nothing. Even some freeware mentions it, but they only talked about the freeware, not this WLAN 11g itself. And how can I tell if I have wireless or not. This seems like a nobrainer, you have it or not. But some documents on my computer mention wireless internet surfing in programs that are there. I use a high speed connection through an external modem that connects to my comuter and the w...

Pass infomration from a form to a report...
I have a form that displays a certain fields from a specific record. How can the selected values be passed to create a report? From my understanding reports can only get information from tables and queries. How can I query th information from a form? Thank you for any help, George On Fri, 26 Mar 2010 12:13:31 -0400, George <MyEmail@FakeEmailAddress.com> wrote: >I have a form that displays a certain fields from a specific record. How > can the selected values be passed to create a report? > From my understanding reports can only get information from ta...

adding another user on same computer
Hi, I have made amew user on my computer so that the woman I live with=20 may use my computer without the danger of corrupting my files=20 accidentially. When we go to the dock on her side - and that is the side from which = I=20 am emailing you - there are two question marks where the icons for 'word = and excel would have been. How can I get this corrected? Just drag the question mark to the desktop and you will find them vanish. Next drag the Word and Excel programs to the dock and you will find it working properly. Anand P "poggi8@comcast.net" <anonymous@dis...