Command line used for opening .xls files and clicking abutton/running a function.

N

ngraved

Ok, here's the thing:

- I have created a set of .xls files (around 150)
- All of these are generated separately in .csv files that I use as scripts..
- Generating is done from inside each file using a "Generate" button linkedto a function:
Sub GenerateCsv_Click()

Dim area As Range
Dim OutBuffer As String
Dim NumberOfLoops As Integer
Dim MyActiveSheet As String
Dim MyName As String
Dim MyNameToPrint As String
Dim MyPath As String
Dim fname As String
Dim ListOfScripts(255) As String
Dim LastScript As Integer
Dim i, j As Integer
Dim UserPath As String
Dim UserDrive As String
Dim CreateMainfile As Boolean
Dim Target_Esim As String

On Error GoTo ErrorHandler

The basic thing I searched for and I need actually is a way of creating a command line script which should open a .xls file and either click the Generate button which is linked to this function, either run the function itself.. I'll figure out a way of parsing through all the files and folders; just need a idea to work with first. Or some site with more info, like the ExcelAPI (if that even helps).

I've kept searching for the past two weeks for something that could help but to no avail. If anyone has some ideas/suggestions I'm all eyes and ears.

Also, combining all the .xls files into a big one is not helpful, already tried that and generating ~170 takes a huge load on the system.


Thanks in advance.
 
N

ngraved

Ok, I finally found something I can work with:

Option Explicit

On Error Resume Next

ExcelMacroExample

Sub ExcelMacroExample()

Dim xlApp
Dim xlBook

Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open("C:\MyWorkbook.xls", 0, True)
xlApp.Run "MyMacro"
xlApp.Quit

Set xlBook = Nothing
Set xlApp = Nothing

End Sub

..vbs script which can be used.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top