1

Is there any way or a tool to convert VBA script into .exe file.

Ex: I will just click on .exe file. so the macro should run automatically and it should work in the similar way we run manually from excel macros.

your inputs are really helpful.

pnuts
  • 58,317
  • 11
  • 87
  • 139
TejaGogineni
  • 25
  • 1
  • 2
  • 8
  • 1
    If I am thinking in the right direction you could use the [**`Workbook_Open()`**](http://msdn.microsoft.com/en-us/library/office/ff194819.aspx) event if you want a macro to start automatically when you open an Excel file. –  Mar 06 '14 at 08:09
  • 1
    There is no way to convert VBA to exe filt because it is not compile language. Please see this [http://stackoverflow.com/questions/4425681/how-can-i-convert-a-vbscript-to-an-executable-exe-file](http://stackoverflow.com/questions/4425681/how-can-i-convert-a-vbscript-to-an-executable-exe-file). – zanhtet Mar 06 '14 at 06:31

1 Answers1

4

Just create a vbs file.

It is almost the same language (VBS and VBA) so the 'translation' should be fairly easy.

You can even do easier like creating a vbs file that opens your workbook and runs the macro inside the workbook.

The file would look like :

Dim XlApp
Dim wb
dim ws
Set XlApp = CreateObject("Excel.Application")
XlApp.Visible = True
Path = "myPath"
Set wb = XlApp.Workbooks.Open(path & "myworkbookname")
set ws = wb.Sheets("mySheetName")

wb.Application.run "module1.macro1"
wb.close
Techie
  • 181
  • 4
  • 14
vinkun
  • 83
  • 1
  • 6