+ Reply to Thread
Results 1 to 4 of 4

Sending VBA code to a file generated by code

  1. #1
    Registered User
    Join Date
    07-28-2015
    Location
    London, England
    MS-Off Ver
    2011 For Mac
    Posts
    6

    Sending VBA code to a file generated by code

    Hello All,

    I am getting a little complex here but I have some VBA code that generates and saves a new Excel file based on a form selection. I would then like the generated file to contain a couple of IF statements but I cannot get this code into the new file.

    I have the following which works well (but might not be the most efficient way):

    Please Login or Register  to view this content.
    So that code creates a document that will be called number.xls and saves it to My Documents with all the information contained. Great. Now I want this newly generated document to contain the following:

    Please Login or Register  to view this content.
    Any idea how I can make sure that small section of code is contained in the new Excel document?

    Thanks,
    Chris

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

    Re: Sending VBA code to a file generated by code

    Chris

    Why not create a template worksheet with the code you want already in it?

    Then you want to create a new sheet base it on that template.

    You could possibly even add the required code to the 'holdnote' sheet.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    07-28-2015
    Location
    London, England
    MS-Off Ver
    2011 For Mac
    Posts
    6

    Re: Sending VBA code to a file generated by code

    Quote Originally Posted by Norie View Post
    Chris

    Why not create a template worksheet with the code you want already in it?

    Then you want to create a new sheet base it on that template.

    You could possibly even add the required code to the 'holdnote' sheet.
    Thanks for your response. I have tried your suggestion in the past week but I still cannot get it to work. Could you help with the code at all?

    Chris

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

    Re: Sending VBA code to a file generated by code

    Chris

    What did you try exactly?

+ 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. change macro code generated through recording
    By abraham30 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-09-2013, 02:38 AM
  2. VBA Code not generated
    By Marcelo Rychter in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-27-2013, 03:06 PM
  3. Sending VBA code from a Module to Code a worksheet
    By jacksocket in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-22-2013, 08:06 PM
  4. Replies: 7
    Last Post: 01-02-2013, 11:58 AM
  5. Sending an Excel File Without Code
    By Mordred in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-10-2011, 05:33 PM
  6. No code getting generated from a record
    By nygwnj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-27-2010, 09:38 PM
  7. Sending excel file email thru VB Code
    By ebin charles in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-24-2010, 08:21 AM
  8. Using code to email a sheet but need to strip the code before sending
    By dcgrove in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 02-05-2009, 01:44 AM

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