+ Reply to Thread
Results 1 to 5 of 5

Codemodule insertlines problem

  1. #1
    Registered User
    Join Date
    10-28-2012
    Location
    Anaheim
    MS-Off Ver
    Excel 2010
    Posts
    3

    Codemodule insertlines problem

    Hi all,

    Basically I'm trying to use a texbox.value to be inserted in a codemodule line. Line 6 & 7 to be exact. The textbox name is "frmNewAccount.txtNewAccountName". The codemodule name is "cmdSaveQuote".

    So here is my problem. The workbook name and file path that I'm trying to change it to doesn't exist yet. I have a userform with a textbox. When the user types in text and clicks "OK" then the new workbook with file path will be created so I don;t know the exact file name. The workbook file name will be whatever the user types into the textbox "txtNewAccountName". In my code I Dim file_name As string and file_name = frmNewAccount.txtNewAccountName. So when I insertlines in the code module I use file_name. It litterally inserts "file_name" instead of the value in the textbox obviously because I'm not doing it correctly. My code is incomplete because I ran into this road block but...

    Here is my code,

    Please Login or Register  to view this content.
    Any help on this would be greatly appreciated. I've been banging my head against the wall for several days trying to get this code to do what I want. Code that writes code is hard. I'm barely learning it now. I didn't even know it existed until about a week ago.

    Moderator note - code tags added for you
    Last edited by Chris M. Johnson; 10-28-2012 at 04:22 PM. Reason: Problem solved

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Codemodule insertlines problem

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Codemodule insertlines problem

    You need to double up the quotes and there are some missing ampersands.
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    10-28-2012
    Location
    Anaheim
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Codemodule insertlines problem

    Sorry,

    I'm new to this forum and any forum for that matter. I'll try harder to follow the rules next time. I appreciate the help in following the rules of posting threads. I apologize in advance if I mess up again.

  5. #5
    Registered User
    Join Date
    10-28-2012
    Location
    Anaheim
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Codemodule insertlines problem

    Awesome! That totally worked. Thanks Norie!

    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)

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