我正在尝试解决其他人编写的代码中的错误。在MS Excel VBA环境中运行的shell函数如下:
Public Function ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
Dim ret&
' Initialize the STARTUPINFO structure:
start.cb = Len(start)
' Start the shelled application:
ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, vbNullString, start, proc)
' Wait for the shelled application to finish:
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
Call GetExitCodeProcess(proc.hProcess, ret&)
Call CloseHandle(proc.hThread)
Call CloseHandle(proc.hProcess)
ExecCmd = ret&
End Function
cmdline$
输入为:" excel.exe W:\ L \ BDTP \ Products \ Mandate FS \ OfferToolUpdate.xlsm"
当我运行代码时,它会打开另一个excel实例并尝试在" W:\ L \ BDTP \ Products \ Mandate.xlsx" ...之后打开一个文件,它会告诉我另外两条错误消息它也找不到" FS \ OfferToolUpdate.xlsm"
显然,由于文件驻留在文件夹的命名约定中的空间,会产生一些错误。
如何在不更改文件夹名称的情况下打开文件?
答案 0 :(得分:1)
我相信您使用的示例如下所示:https://support.microsoft.com/en-us/kb/129796
...
只需更新执行行以包装文件:
ExecCmd "excel.exe ""U:\ADMINISTRATION\Expenses\Some File.xlsx"""
答案 1 :(得分:0)
我暂时找到了一个可行的解决方法,但我确信有更专业的方法可以解决这个问题。我已将输入命令行更改为引号:
.directive('truncate',["$window", function($window, $compile){
return {
restrict: 'A',
templateUrl: 'template/truncate.html',
link: function (scope, element, attrs) {
var height = element[0].offsetHeight;
var shouldBetruncated = height>200;
if(shouldBetruncated){
// want my template to load here, otherwise template is not loaded
};
}
}
}])
.run(function ($templateCache) {
$templateCache.put('template/truncate.html',
'template code'
);
})