+ Reply to Thread
Results 1 to 6 of 6

Main first

  1. #1
    Jenni_Sweden
    Guest

    Main first

    How do I get my program to start at the subroutine main? (I have Visual Basic
    6.3). My code is:
    Public Sub Main()
    Public lengthDate As Integer
    Worksheets("Indata").Range("f9") = "main"
    dagensDatumKnapp.Show
    skapa
    End Sub
    End Sub

    In main I want to create certain things e.g. display text in a cell. However
    main is nerevr executed? Help!

  2. #2
    NickHK
    Guest

    Re: Main first

    Jenni,
    "Sub Main" has no special meaning in VBA as it does in VB standalone.
    But in the Workbook_Open event you can call it, or any other sub/function
    you wish.
    e.g. Call Main()

    NickHK

    "Jenni_Sweden" <[email protected]> wrote in message
    news:[email protected]...
    > How do I get my program to start at the subroutine main? (I have Visual

    Basic
    > 6.3). My code is:
    > Public Sub Main()
    > Public lengthDate As Integer
    > Worksheets("Indata").Range("f9") = "main"
    > dagensDatumKnapp.Show
    > skapa
    > End Sub
    > End Sub
    >
    > In main I want to create certain things e.g. display text in a cell.

    However
    > main is nerevr executed? Help!




  3. #3
    Jenni_Sweden
    Guest

    Re: Main first

    thankx. but how do you specify where the program begins? as it is now i am
    not sure where in the code the program starts running!
    --
    I am very thankful for any fast assistance!


    "NickHK" skrev:

    > Jenni,
    > "Sub Main" has no special meaning in VBA as it does in VB standalone.
    > But in the Workbook_Open event you can call it, or any other sub/function
    > you wish.
    > e.g. Call Main()
    >
    > NickHK
    >
    > "Jenni_Sweden" <[email protected]> wrote in message
    > news:[email protected]...
    > > How do I get my program to start at the subroutine main? (I have Visual

    > Basic
    > > 6.3). My code is:
    > > Public Sub Main()
    > > Public lengthDate As Integer
    > > Worksheets("Indata").Range("f9") = "main"
    > > dagensDatumKnapp.Show
    > > skapa
    > > End Sub
    > > End Sub
    > >
    > > In main I want to create certain things e.g. display text in a cell.

    > However
    > > main is nerevr executed? Help!

    >
    >
    >


  4. #4
    Bob Phillips
    Guest

    Re: Main first

    You could rename it Auto_Open.

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Jenni_Sweden" <[email protected]> wrote in message
    news:[email protected]...
    > How do I get my program to start at the subroutine main? (I have Visual

    Basic
    > 6.3). My code is:
    > Public Sub Main()
    > Public lengthDate As Integer
    > Worksheets("Indata").Range("f9") = "main"
    > dagensDatumKnapp.Show
    > skapa
    > End Sub
    > End Sub
    >
    > In main I want to create certain things e.g. display text in a cell.

    However
    > main is nerevr executed? Help!




  5. #5
    NickHK
    Guest

    Re: Main first

    Jenni,
    As Bob pointed you can rename "Auto-Open" to achieve the same, although
    Workbook_Open fires first.
    And a "Auto-Open" routine needs to be in a module, not in a worksheet or
    ThisWorkbook.

    NickHK

    "Jenni_Sweden" <[email protected]> wrote in message
    news:[email protected]...
    > thankx. but how do you specify where the program begins? as it is now i am
    > not sure where in the code the program starts running!
    > --
    > I am very thankful for any fast assistance!
    >
    >
    > "NickHK" skrev:
    >
    > > Jenni,
    > > "Sub Main" has no special meaning in VBA as it does in VB standalone.
    > > But in the Workbook_Open event you can call it, or any other

    sub/function
    > > you wish.
    > > e.g. Call Main()
    > >
    > > NickHK
    > >
    > > "Jenni_Sweden" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > How do I get my program to start at the subroutine main? (I have

    Visual
    > > Basic
    > > > 6.3). My code is:
    > > > Public Sub Main()
    > > > Public lengthDate As Integer
    > > > Worksheets("Indata").Range("f9") = "main"
    > > > dagensDatumKnapp.Show
    > > > skapa
    > > > End Sub
    > > > End Sub
    > > >
    > > > In main I want to create certain things e.g. display text in a cell.

    > > However
    > > > main is nerevr executed? Help!

    > >
    > >
    > >




  6. #6
    Bob Phillips
    Guest

    Re: Main first

    Which is probably where her code is Nick.

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "NickHK" <[email protected]> wrote in message
    news:[email protected]...
    > Jenni,
    > As Bob pointed you can rename "Auto-Open" to achieve the same, although
    > Workbook_Open fires first.
    > And a "Auto-Open" routine needs to be in a module, not in a worksheet or
    > ThisWorkbook.
    >
    > NickHK
    >
    > "Jenni_Sweden" <[email protected]> wrote in message
    > news:[email protected]...
    > > thankx. but how do you specify where the program begins? as it is now i

    am
    > > not sure where in the code the program starts running!
    > > --
    > > I am very thankful for any fast assistance!
    > >
    > >
    > > "NickHK" skrev:
    > >
    > > > Jenni,
    > > > "Sub Main" has no special meaning in VBA as it does in VB standalone.
    > > > But in the Workbook_Open event you can call it, or any other

    > sub/function
    > > > you wish.
    > > > e.g. Call Main()
    > > >
    > > > NickHK
    > > >
    > > > "Jenni_Sweden" <[email protected]> wrote in

    message
    > > > news:[email protected]...
    > > > > How do I get my program to start at the subroutine main? (I have

    > Visual
    > > > Basic
    > > > > 6.3). My code is:
    > > > > Public Sub Main()
    > > > > Public lengthDate As Integer
    > > > > Worksheets("Indata").Range("f9") = "main"
    > > > > dagensDatumKnapp.Show
    > > > > skapa
    > > > > End Sub
    > > > > End Sub
    > > > >
    > > > > In main I want to create certain things e.g. display text in a cell.
    > > > However
    > > > > main is nerevr executed? Help!
    > > >
    > > >
    > > >

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1