Conexão entre 2 ou mais executáveis, um abrir o outro e compartilhar dados

Tenho um executável (.exe) Excel que necessita em tempo de execução abrir outro executável (.exe) Excel. O 1º .exe chama rotinas do 2º .exe, que executa uma consulta SQL e retorna ao 1º .exe o restultado.

Como .xlsm está funcionando, mas ao compilar para .exe não consigo. É necessário que os dois arquivos sejam .exe

É possível conexão entre 2 ou mais executáveis, e um executável abrir o outro em tempo de execução?

Grato.

Nós escrevemos para você com uma tradução automática porque falamos apenas francês ou inglês.
Para executar um EXE de sua pasta de trabalho do Excel, você deve fornecer o caminho completo para o EXE. Se assumirmos que você está colocando o EXE no mesmo diretório que sua pasta de trabalho do Excel e estiver usando ThisWorkbook.Path, isso pode causar um problema porque o Padlock XLS coloca a pasta de trabalho do Excel em um diretório virtual.
Nosso guia do usuário tem a solução para obter o caminho para os arquivos no mesmo diretório que o EXE:

Grato pela resposta.

Funciona quando a extensão não é .exe

O 1º Arquivo é .exe e necessita abrir e referenciar célula no 2º Arquivo, também .exe
Tentei o código fornecido por vocês mas não obtive êxito.
O que estou fazendo de errado?

Public Function PathToFile(Filename As String)
Dim XLSPadlock As Object
On Error GoTo Err
Set XLSPadlock = Application.COMAddIns(“GXLSForm.GXLSFormula”).Object
PathToFile = XLSPadlock.PLEvalVar(“EXEPath”) & Filename
Exit Function
Err:
PathToFile = “”
End Function

Sub TESTE()
Workbooks.Open Filename:=PathToFile(“data.exe”)
MsgBox Application.Workbooks(“data.exe”).Worksheets(1).Range(“A1”)
End Sub

The error lies here. You can’t open an EXE file with Workbooks.Open.

How do I access the .xlsm of the virtual drive to write information?
If possible I may communicate between two protected workbooks (.exe).

I use the active workbook itself as a database, and to connect it I use:

db = OpenDataBase (ThisWorkbook.Fullname, False, False, Excel 8.0)

But it is not recording the information this way.

The solution I believe would also address this topic.

Grateful for any help.

Maybe this section in the user guide can be helpful in your case:

Grateful for the answer.
But it didn’t work out for what I need, it was my fault that I didn’t explain better.

In the same Workook some spreadsheets are front end and others are backend (database). This is the process:

1.Enter the value in the cell (Spreadsheet-Frontend)
2.The value is copied via SQL to database (Spreadsheet-Backend)

To use SQL, I make the DAO connection:

Set db = OpenDatabase (ThisWorkbook.FullName, True, False, “Excel 8.0”)

In .xlsm it works, writes the value to the Spreadsheet-Frontend and the Database (Spreadsheet Backend).

In .exe, it does not work, it writes the value to the Spreadsheet-Frontend, where it was typed, but does not update via SQL the database (Spreadsheet-Backend).

I observed:
After processing Set db = OpenDatabase (ThisWorkbook.FullName, True, False, “Excel 8.0”), another copy of Workbook.xlsm opens and the focus of Workbook.exe is lost, so that closing Workbook.exe , it is also requested to save Workbook.xlsm, but even saving does not save the data.

Below is part of the code I use:

vValue = Target.value

Set db = OpenDatabase (ThisWorkbook.FullName, True, False, “Excel 8.0”)

bd = “bd_company $”
sql = “SELECT *”
sql = sql & “FROM” & “[” & bd & “]” & “”
Set rs = db.OpenRecordset (sql)

If rs.EOF Then
rs.AddNew
else
rs.Edit
end if
rs (“name_company”) = vValue
rs.Update
rs.Close

Please any help to finalize my project. Just missing it to finish. Thankful.

How to update, save attached .xlsm file inside .exe?

What do you mean by “how to update”? Can you tell us more?

It used as database the own Workbook .exe and SQL via DAO connection, making the call to the database with the code below:

Set db = OpenDatabase (ThisWorkbook.FullName, True, False, “Excel 8.0”)

I used PathToComplileFile as you indicated in your last answer, but it didn’t work either.

When I open the database I realize that a second copy of the Workbook opens, which actually records the changed data at run time, but when exiting .exe, does not save the data in this second copy of the Workbook, opened by the DAO connection. , only writes the data before opening the database.

Attempting to troubleshoot, I attached a Workbook .xlsm (Backend) to .exe (Frontend) for use as a database, yet did not write the information when exiting .exe. Data is written to Workbook Frontend (.exe), but does not remain written to Workbook Backend (database) when exiting .exe.

It would be better if there was just how to use only one Workbook, as I designed the original project, using some spreadsheets like Frontend and others as database (Backend), because I realize that whether or not using the attached Workbook or single Workbook, the problem is the same, do not write data to database when exiting .exe

Thanks for any help you can provide me.