JMP 可以启动 excel.xlsm 文件吗?JMP jsl 是否能够“启动”Excel .xlsm(宏编辑)文件,这样它实际上是“双击”文件来打开它并且不会尝试导入它?
我使用 Excel 宏进行数据库提取,因为它比 JMP ODBC 提取工具快 100 倍,并且希望我的 jsl 代码运行宏文件。
提前致谢!
数据存取回复:JMP 可以启动 excel.xlsm 文件吗?这太完美了,而且很有魅力!
@ih , 感谢您的帮助。
回复:JMP 可以启动 excel.xlsm 文件吗?糟糕,我错过了最后一行的文件扩展名:
/* Function: openFileInOSDefault
Open file in the operating system default program
Include this once at the top of your script
Arguments:
filepath - local path file
*/
openFileInOSDefault = Function({filepath},
If( Host is( "Windows" ),
Run Program(
Executable( "PowerShell.exe" ),
Options(
Eval Insert( "\[-Command "& {Start-Process '^filepath^'}"]\" )
),
Read function( "text" )
);
,
RunProgram(
Executable( "/usr/bin/open" ),
Options( filepath ),
ReadFunction( "text" )
)
);
);
//Now in your script you can just call the function
openFileInOSDefault("C:\Users\Me\Desktop\test.xlsx")回复:JMP 可以启动 excel.xlsm 文件吗?我收到这个错误,有什么想法吗?
“Start-Process:由于错误,该命令无法运行:系统找不到指定的文件。
行:1 字符:4
+ & {启动进程'C:\Users\Me\Desktop\test'}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [启动进程],InvalidOperationException
+FullyQualifiedErrorId:InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
”
回复:JMP 可以启动 excel.xlsm 文件吗?尝试一下:
/* Function: openFileInOSDefault
Open file in the operating system default program
Include this once at the top of your script
Arguments:
filepath - local path file
*/
openFileInOSDefault = Function({filepath},
If( Host is( "Windows" ),
Run Program(
Executable( "PowerShell.exe" ),
Options(
Eval Insert( "\[-Command "& {Start-Process '^filepath^'}"]\" )
),
Read function( "text" )
);
,
RunProgram(
Executable( "/usr/bin/open" ),
Options( filepath ),
ReadFunction( "text" )
)
);
);
//Now in your script you can just call the function
openFileInOSDefault("C:\Users\Me\Desktop\test")回复:JMP 可以启动 excel.xlsm 文件吗?假设我想打开一个名为“Test.xlsx”的文件,该文件位于“C:\Users\Me\Desktop\”。代码会是什么样子?
我已尝试以下方法,但似乎不起作用:
rp0 = Run Program(
Executable( "Excel.EXE" ),
Options("C:\Users\Me\Desktop\test"),
Read Function("text")
);回复:JMP 可以启动 excel.xlsm 文件吗?如果您知道每个人都在 Windows 上或安装了 Powershell,您可以使用运行程序使用操作系统定义的默认程序打开文件:
在操作系统默认程序中打开文件
回复:JMP 可以启动 excel.xlsm 文件吗?谢谢@tx尼尔森,但我不确定这就是答案。如果我不知道“Excel.exe:”保存在别人计算机上的什么位置,我如何与他人共享我的脚本?
回复:JMP 可以启动 excel.xlsm 文件吗?查看功能

在脚本索引中