quinta-feira, 1 de agosto de 2013

How to call a excel macro from VB6

Very simple!

This is old stuff, nonetheless, useful stuff
 
Private Sub Command1_Click()
  Dim x As Object
    
   Set x = CreateObject("Excel.Application") ' Create excel object

    x.Workbooks.Open txtPath.Text  'Open File; ex: c:\abc.xls

    x.Visible = True 'Turn visible on

    x.Run txtMacro.Text  'Execute Macro - Keep in mind that you already know the name of the macro

End Sub

Há!

Nenhum comentário:

Postar um comentário