Results 1 to 9 of 9

Thread: ExtendingInsensibility into Code modules. Copy table contents to VBIDE VB Editor code modules. ..

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10

    Spare Post for later notes

    Spare Post for misc. notes













    Before doing this, select File > Options > Trust Center > Trust Center Settings... > Macro Settings.
    Make sure that the check box 'Trust access to the VBA project object model' is ticked, then click OK.

    Use the following as starting point and edit it as you like.

    Code:
    Sub CreateXLSM()
        Dim wbk As Workbook
        Dim vbc As Object ' VBComponent
        Dim mdl As Object ' CodeModule
        Set wbk = Workbooks.Add(xlWBATWorksheet)
        Set vbc = wbk.VBProject.VBComponents.Add(1) ' vbext_ct_StdModule
        Set mdl = vbc.CodeModule
        mdl.AddFromString _
            "Sub Test()" & vbCrLf & _
            "    MsgBox ""Hello World!"", vbInformation" & vbCrLf & _
            "End Sub"
        wbk.SaveAs Filename:="Test.xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled
        wbk.Close
    End Sub





    https://eileenslounge.com/viewtopic.php?f=30&t=36283



    http://www.excelfox.com/forum/showth...0849#post10849







    Rem Ref
    ' http://www.eileenslounge.com/viewtopic.php?f=30&t=31395
    ' http://www.cpearson.com/excel/vbe.aspx
    http://www.excelfox.com/forum/showth...ll=1#post10971
    http://www.excelfox.com/forum/showth...1011#post11011
    Last edited by DocAElstein; 03-17-2021 at 04:12 PM.

Similar Threads

  1. Replies: 2
    Last Post: 11-29-2017, 10:45 AM
  2. Backup all modules, class modules and userforms to a selectable folder
    By MrBlackd in forum Excel and VBA Tips and Tricks
    Replies: 1
    Last Post: 04-06-2014, 08:33 AM
  3. change table top row to a different colour with html code
    By peter renton in forum Excel Help
    Replies: 2
    Last Post: 02-17-2014, 08:08 PM
  4. code not to copy formula
    By peter renton in forum Excel Help
    Replies: 5
    Last Post: 01-03-2014, 06:31 AM
  5. Replies: 4
    Last Post: 05-14-2012, 11:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •