I want to fetch macros name in excel 2007 and save it in text file automatically using vbscript -


i want fetch macros name in excel 2007 , save in text file automatically using vbscript. done using vb6

here code

private sub form_load() ' declare variables access excel workbook.      dim objxlapp excel.application      dim objxlworkbooks excel.workbooks      dim objxlabc excel.workbook      ' declare variables access macros in workbook.     dim objproject vbide.vbproject     dim objcomponent vbide.vbcomponent     dim objcode vbide.codemodule      ' declare other miscellaneous variables.     dim iline integer     dim sprocname string     dim pk vbext_prockind     dim macro_name string     dim ifileno integer     dim integer     open "d:\file\macro.txt" append #1      ' open excel, , open workbook.     set objxlapp = new excel.application     set objxlworkbooks = objxlapp.workbooks     set objxlabc = objxlworkbooks.open("c:\users\macro\macros.xls")      ' empty list box.     list1.clear      ' project details in workbook.     set objproject = objxlabc.vbproject      ' iterate through each component in project.     each objcomponent in objproject.vbcomponents          ' find code module project.         set objcode = objcomponent.codemodule          ' scan through code module, looking procedures.         iline = 1         while iline < objcode.countoflines             sprocname = objcode.procofline(iline, pk)             if sprocname <> ""                 ' found procedure. display details, , skip                 ' end of procedure.                 list1.additem objcomponent.name & vbtab & sprocname                 iline = iline + objcode.proccountlines(sprocname, pk)                 = 0 list1.listcount - 1                     print #1, list1.list(i)                 next                 close #1             else                 ' line has no procedure, go next line.                 iline = iline + 1             end if         loop         set objcode = nothing         set objcomponent = nothing     next      set objproject = nothing      ' clean , exit.     objxlabc.close     objxlapp.quit  end sub 

how convert code vbscript or how find macro names in excel using vbscript???


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -