考虑以下代码:
using Microsoft.Office.Interop.Word;
ApplicationClass _application = new ApplicationClass();
Run Code Online (Sandbox Code Playgroud)
我可以从_application启动的Winword.exe进程中获取PID吗?
我需要PID因为文件损坏,我只是不能退出ApplicationClass,即使使用这段代码:
_application.Quit(ref saveFile, ref missing, ref missing);
System.Runtime.InteropServices.Marshal.ReleaseComObject(_application);
GC.Collect();
GC.WaitForPendingFinalizers();
Run Code Online (Sandbox Code Playgroud)
我无法搜索winword.exe进程并将其杀死,因为我会有几个,而且我不知道要杀哪个.如果我可以为每个ApplicationClass获取一个PID,我可能会杀死正确的winword.exe进程,这会给我带来麻烦.
我在VBA中有一个包含Unicode字符的字符串。
我想在包含该字符串的消息框中显示该字符串。
但是,消息框仅包含一个问号,而不是字符串。
MCVE:
Dim s As String
s = ChrW(5123)
MsgBox s
Run Code Online (Sandbox Code Playgroud)