+ Reply to Thread
Results 1 to 3 of 3

Syntax error in writing code to reference a VBComponent

  1. #1
    Registered User
    Join Date
    06-29-2015
    Location
    CT, USA
    MS-Off Ver
    Standard 2010
    Posts
    30

    Syntax error in writing code to reference a VBComponent

    Trying to write code to add ActiveX Command button to search Column C for names. Script to add button works fine when I paste it into the code associated with the button but I'm unable to decipher how to write the code as a string. I want to do this because each day I regenerate this sheet with new data and I don't want to manually add the code in every day. The error I get is "Compile error: Syntax error". The error is arising from what comes after codeText. Any help would be greatly appreciated. Thanks.

    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Syntax error in writing code to reference a VBComponent

    The last line of code that creates the string has a continuation character at the end but it's the end of the string. Remove the & and underscore.

    Please Login or Register  to view this content.
    That being said, this approach may actually work but seems complicated to me. I would just create one file, put the button and code in it, and have it open the other file to do the work.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    06-29-2015
    Location
    CT, USA
    MS-Off Ver
    Standard 2010
    Posts
    30

    Re: Syntax error in writing code to reference a VBComponent

    Thanks 6StringJazzer! Your suggestion led to my finding other errors but it works great now! Below is the working code:

    Please Login or Register  to view this content.

+ 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] Syntax error in code???
    By lundy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-06-2012, 01:39 PM
  2. [SOLVED] Syntax error with the following code - Worksheet Changed
    By UsmanBPD in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-28-2012, 08:03 AM
  3. vba code...compile and syntax error
    By prabhuduraraj09 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-26-2012, 10:56 AM
  4. Error when Writing code by macro
    By bagullo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-11-2012, 08:03 AM
  5. Event button error & code syntax in VBA...
    By BGiffin2004 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-12-2011, 05:54 PM
  6. Writing Code to reference a newly renamed worksheet
    By sportsranker in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-22-2008, 02:24 PM
  7. [SOLVED] Syntax error in code
    By JOUIOUI in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2006, 11:10 AM
  8. [SOLVED] What's the syntax error with this SendKeys code?
    By Phil1982 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-19-2006, 02:55 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