+ Reply to Thread
Results 1 to 4 of 4

creating a public constant by concatenating string......gives compile error

Hybrid View

welchs101 creating a public constant by... 11-26-2011, 06:23 AM
royUK Re: creating a public... 11-26-2011, 06:28 AM
welchs101 Re: creating a public... 11-26-2011, 07:10 AM
royUK Re: creating a public... 11-26-2011, 07:23 AM
  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    creating a public constant by concatenating string......gives compile error

    I am trying to create a constant such as the following but it gives me an error


    Public Const Valid_appendixsub_inputfile = "Appendix " & Chr(10) & "Subcategory"

    any ideas why?

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: creating a public constant by concatenating string......gives compile error

    You can't define a Constant or Variable like that
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: creating a public constant by concatenating string......gives compile error

    ok. any suggestions on what to do?

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: creating a public constant by concatenating string......gives compile error

    Not really sure what you are doing but maybe
    Option Explicit
    
    Public appendixsub_inputfile As String
    Function InitVar() As Boolean
        appendixsub_inputfile = "Appendix " & Chr(10) & "Subcategory"
        InitVar = True
    End Function
    Sub Test()
        If Not InitVar Then InitVar
        MsgBox appendixsub_inputfile
    End Sub

+ 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