How to create an executable application for Excel macro?

I have two tables ("Old" and "New") and a VB Script macro. The macro works in one ("New"), compares the contents of the other ("Old"), and then outputs the results back to the "new" table.

I would like to create an executable file in which I enter two file names, and click the start button to simplify this procedure. The current procedure requires opening both files, and then cutting and pasting the Script into the VB "New" editor and running there. I am looking for advice on which programming language or tools I can use to create this application in Windows XP for working with spreadsheets created in Excel 2007.

Is it possible to use C # to write a simple application that can do this?

If you could point me to resources about writing applications in C # for interacting with Excel, that would be greatly appreciated.

This is my first attempt to write an application that interacts with Excel. Perhaps this is not possible. If this happens, let me know.

+3
source share
4 answers

Why not just create an excel file called "Compare.Xls" that will use the following code to allow the user to select files and run Compare on them.

Dim fd As FileDialog
Dim sOldFile As String
Dim sNewFile As String

Set fd = Application.FileDialog(msoFileDialogOpen)

  fd.AllowMultiSelect = False

  MsgBox "Please Select the Old File"
  fd.Show
  Workbooks.Open fd.SelectedItems(1)
  sOldFile = ActiveWorkbook.Name

  MsgBox "Please Select the New File"
  fd.Show
  Workbooks.Open fd.SelectedItems(1)
  sNewFile = ActiveWorkbook.Name

, , , "" "" "", 1 .

EDIT: , ThisWorkbook Workbook_Open , - Compare.Xls.

+1

, Open office org, . #. ProcessStartInfo Process Class. , ( ) .

0

, "" excel, , "", .

compare.xlt, .

0

Source: https://habr.com/ru/post/1731093/


All Articles