View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Kletcho Kletcho is offline
external usenet poster
 
Posts: 36
Default include VBA macros as text file

Suresh,

If I understand your request, you want another program besides excel to
create a text file that is a VBA macro. An option for you may be to
use VB script. VB script is like VBA but a little less function and it
allows you to control excel from outside of excel. Here is an example
to get you started:

dim ExcelApp, ExcelWB, ExcelWS
set ExcelApp = createobject("Excel.Application")
set ExcelWB = ExcelApp.Workbooks.Open("C:\MyFile.xls")
set ExcelWS = ExcelWB.Worksheets("MyWorksheet")
ExcelWB.Range("A1") = "Some value"
set ExcelWS = Nothing
set ExcelWB = Nothing
ExcelApp.Close

This is all untested. Save the file as a .vbs file and run. Hope
that's what you were looking for.