I need some help!!!
I am trying to call a commandbutton1_click() sub defined in excel from vb. I need to process any of the incoming excel files and have the vb application behave like someone were pushing the button...
I thought I could call it like I would call an excel macro.. but its saying Macro not found! This is what I have so far
Sub ProcessFiles(ByVal ProcessFile As String)
Dim XLApp As Object
Dim XLBook As Object
Dim VBComp As Object
Dim SheetName As String
SheetName = "'Sheet1$'"
XLApp = CreateObject("Excel.Application")
XLBook = XLApp.workbooks.open(ProcessFile)
XLApp.run(ProcessFile & "!" & SheetName & "!CommandButton1.Click()")
VBComp = XLBook.VBProject.VBComponents("Module1")
VBComp = Nothing
XLBook = Nothing
XLApp = Nothing
Any help is greatly appreciated.