Store objects on excel sheet?

Hi, does anyone know a way to store objects inside the worksheet object itself? Or should we serialize it and save it as a custom property? The data that I want to save, I really do not want to sit on a sheet.

+5
source share
2 answers

Depending on what you want to add to the sheet, (the data I assumed meant text), if so. Add a link to Application Extensibilitythe extensibility

and add whatever you want. be it an auxiliary procedure in a module or in a sheet. I used something like this to add an auxiliary procedure to the new module, but the same idea will work on the worksheet.

 Sub AddSomething()
    Dim VBCodeMod As CodeModule
    Dim LineNum As Long
    Set VBCodeMod = ActiveWorkbook.VBProject.VBComponents("Sheet1").CodeModule
    With VBCodeMod
    LineNum = .CountOfLines + 1
    .InsertLines LineNum, _
    "Dim thing as String"& Chr(13) & _
    "thing = ""toothpaste"""& Chr(13) & _
    " 'comments too"
    End With

, , , , . , ,

+2

All Articles