+ Reply to Thread
Results 1 to 4 of 4

Why Public parameter is not transfered to PERSONAL.XLSB

  1. #1
    Registered User
    Join Date
    01-18-2011
    Location
    Ramat Hasharon, Israel
    MS-Off Ver
    Excel 2010
    Posts
    16

    Why Public parameter is not transfered to PERSONAL.XLSB

    My workbook includes several Sheets.

    Sheet1 has the table.
    In the VBA item for Sheet1 I declare:
    Public variable1name As String
    and set a value:
    variable1name = "string"

    Then I call a subroutine in PERSONAL.XLSB:
    Application.Run "Personal.xlsb!subroutine1"

    Inside Module1 in PERSONAL.XLSB:
    Sub subroutine1()
    MsgBox variable1name

    When I run subroutine1 from Sheet1, the MsgBox displays blank as the value of variable1name.

    My question: why the value of the Public parameter variable1name is not transfered to PERSONAL.XLSB?

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Why Public parameter is not transfered to PERSONAL.XLSB

    Place the declarationline in the declarationarea of a macromodule, not in a sheet/workbook/userform-module.



  3. #3
    Registered User
    Join Date
    01-18-2011
    Location
    Ramat Hasharon, Israel
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Why Public parameter is not transfered to PERSONAL.XLSB

    Thanks snb.

    I tried putting the declarations
    (e.g.
    Public variable1name As String
    Public variable2name As Integer
    ) in:
    Module1 created under VBAProject (workbook) - it didn't work;
    ThisWorkbook under VBAProject (workbook) - it didn't work;
    Module1 created under VBAProject (PERSONAL.XLSB) - it didn't work.

    My question is: where is the declaration area of a macro module?

  4. #4
    Registered User
    Join Date
    01-18-2011
    Location
    Ramat Hasharon, Israel
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Why Public parameter is not transfered to PERSONAL.XLSB

    Please, can anyone reply?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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