+ Reply to Thread
Results 1 to 4 of 4

Need Data type to declare a Variable

  1. #1
    Registered User
    Join Date
    12-10-2011
    Location
    Chennai
    MS-Off Ver
    Excel 2007
    Posts
    56

    Need Data type to declare a Variable

    Hi,

    I am creating a VBA Code, in which the output values have mulitple double quotes in it , like,

    id (1) = create users "/" and/or "notify change"
    id (2) = modify users "and"/"or"

    I tried declaring the above values as String variables, however due to the presence of several double quotes, its throwing an error.

    Kindly advice me on the correct data type to used for the above scenario

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Need Data type to declare a Variable

    Hi,

    Can you clarify what the references after the = signs are. I'm assuming the id variable is an array.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Need Data type to declare a Variable

    Hi,

    Try one of the following. If you want a 'double quote' inside a string you have to double up (i.e. put 2 double quotes consecutively). Alternately you can use chr(34) which is the equivalent of ONE 'double quote'.
    Please Login or Register  to view this content.
    Lewis

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Need Data type to declare a Variable

    In explicit strings, VBA uses a double quote for a quote mark.

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Using a formula to declare a variable's value
    By jacob@thepenpoint in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-02-2012, 05:00 PM
  2. Declare Unique Variable for several Sub's
    By Nlex in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-27-2011, 05:02 AM
  3. Easy Declare Variable
    By Duncan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-20-2006, 10:35 AM
  4. How can use LONGLONG type of C++ Dll in 'Declare Function' statement?
    By Zoo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-10-2006, 07:10 AM
  5. [SOLVED] How to declare variable as public.
    By Mark in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-07-2005, 02:06 PM

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