Hi, I would like to know if someone can help me to execute Easymorph and a specific sql consult+extraccion from Excel with vba code.
Could be i suppose:
Through Powersheel specifying the consukt in parameter
Creating a . bat and executing it
Thanks a lot in advance
Hi Marc and welcome to the Community!
See this topic on calling Excel VBA macros from PowerShell:
Has anyone had any experience trying to import a password-protected xlsx file?
I’m currently faced with the error message: ‘File has wrong format. End of Central Directory record could not be found. Worksheet name cannot be changed.’
Has anyone any suggestions?
Executing external applications and .bat files in explained here:
Hi and Thanks
On the first topic i was more thinking about launching a “querry + exls extraccion” project from an excel.xlsm program and then integrate the new data into that excel.xlsm with vba code like:
ruta1 = ThisWorkbook.Path
ruta2 = ruta1 & “\bbdd_prod.xls”
Set fs = CreateObject(“Scripting.FileSystemObject”)
Set a = fs.CreateTextFile(ruta1 & “\extractor.bat”, True)
fini = Split(Sheets(“PARAMETROS”).Cells(10, 2).Value, “/”)
ffin = Split(Sheets(“PARAMETROS”).Cells(11, 2).Value, “/”)
d1 = fini(0) & “/” & fini(1) & “/” & fini(2)
d2 = ffin(0) & “/” & ffin(1) & “/” & ffin(2)
ruta = Split(ruta1, “”)
param00 = “H:”
param01 = "cd " & Right(ruta1, 7)
llam1 = Sheets(“PARAMETROS”).Cells(12, 2).Value
llam2 = Chr(34) & d1 & Chr(34) & " " & Chr(34) & d2 & Chr(34)
llam3 = Chr(34) & ruta2 & Chr(34) & " " & Chr(34) & “marc” & Chr(34)
param2 = llam1 & " " & llam2 & " " & llam3
Dim lValDev As Long
ruta1 = ThisWorkbook.Path
ruta10 = ruta1 & “\extractor.bat”
param2 = “extractor.bat”
lValDev2 = ShellExecute(0, “OPEN”, ruta10, param2, “”, 0)
I’m not sure I follow you. What’s your question exactly?
To launch easymorph on a second plan from an other application.and close it once the data are collected and extracted to an file in a specific folder
I would like to do it createting and executing a .bat file for example.
The question is what should i write in that .bat file
OK, now I understand. Thanks for the clarification. EasyMorph projects can be executed from the command line and .bat files. See this help article for more details:
Hi, Thanks for the info. I have try that command:
morph.exe /c /report bbdd_c28_v3.morph
but windows tell me that it can not find the morph.exe file.
Maybe is because i am still working with the demo version…
Yes, the free edition doesn’t allow running EasyMorph from the command line. You can request a trial key right in the application, on the Start screen. It will be delivered automatically.