com

Excel workbooks.saveas() error in powershell

荒凉一梦 提交于 2019-12-06 23:45:27
I'm trying to convert .xls files to .xlxs I tried many variations of this code but every time i'm facing this error message : Exception lors de l'appel de « SaveAs » avec « 2 » argument(s) : « La méthode SaveAs de la classe Workbook a échoué. » Au caractère C:\temp\xlsx.ps1:18 : 6 try{$opendoc.saveas($basename, $saveFormat)} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CategoryInfo : NotSpecified: (:) [], MethodInvocationException FullyQualifiedErrorId : ComMethodTargetInvocation Here is my code : $excel = new-object -comobject excel.application $excel.Visible = $false $saveFormat =

How do I know that `ThisWorkbook` is a `Workbook`?

戏子无情 提交于 2019-12-06 23:01:29
问题 I'm working with the VBIDE API, and can't assume that the host application is Excel, or any Office app either. So all I know is that I'm looking at a VBComponent , and that its Type is vbext_ct_document . In the VBE's immediate pane I can get this output: ?TypeName(Application.VBE.ActiveVBProject.VBComponents("Sheet1")) VBComponent ?TypeName(Sheet1) Worksheet But the Sheet1 object only exists in the runtime environment, so if I'm a C# add-in I don't even see it. The only thing that gets

How to deploy a COM

主宰稳场 提交于 2019-12-06 22:51:33
I just finished building my new COM project (C#, .NET 3.5). This project will be called by a VFP application. It's working great on my development machine, but now I need to know how to deploy it on the user's machine. Click Once isn't available for this kind of project, so I guess I'm stuck with manually distributing the DLL. So, where should I put the DLL and how do I register it? BTW, the 3.5 framework is already installed on the user's machine. TIA I've really never used RegSvr32 with .Net assemblies, rather I use the regasm with the /codebase option: C:\Windows\Microsoft.NET\Framework\v2

Display file properties dialog for files in different directories

醉酒当歌 提交于 2019-12-06 21:03:25
I'm trying to open the default file properties dialog but unable to get it working property for files in different directories. I need to obtain IContextMenu* interface pointer for files in different directories (or even drives). I expect to see "Various folders" in the properties dialog. This is my naive approach: int main() { CoInitialize(NULL); LPOLESTR pszFile = OLESTR("c:\\Windows\\notepad.exe"); LPOLESTR pszFile2 = OLESTR("c:\\Windows\\System32\\notepad.exe"); LPITEMIDLIST pidl; LPITEMIDLIST pidl2; LPCITEMIDLIST pidlItem; LPCITEMIDLIST pidlItem2; HRESULT hr; IShellFolder* pFolder;

How to get my IHttpNegotiate implementation called by IWebBrowser?

匆匆过客 提交于 2019-12-06 20:14:36
I use cwebpage_src code and I need to update some HTTP request headers while clicking on links. As I understand it can be done with self implementation of IHttpNegotiate->BeginTransaction. But how to get my IHttpNegotiate implementation called?? Thanks! Although I have no experience of writing one, I believe that you need to write an asynchronous pluggable protocol , as recommended in this thread . Details of how and why to do this are scattered around the web in various places, but the best exposition that I've read is in this post by Igor Tandetnik (abridged here for brevity): There are

a Reference to 'Microsoft Windows Installer Object Library' could not be added

六月ゝ 毕业季﹏ 提交于 2019-12-06 19:45:32
问题 I'm unable to add reference to 'Microsoft Windows Installer Object Library' with VS2012. Any ideas, what could cause this issue? When I try to create reference to the COM component, I get this error message "a reference to 'Microsoft Windows Installer Object Library' could not be added". The VS project is basic class library (c# x86). 回答1: In Visual Studio go to References > Add Reference... > COM > Browse... > %WINDIR%\system32\msi.dll . Worked for me on VS2012. 回答2: Check ur Regedit ,

Is it possible to expose a C# Enum to COM Interop callers, and if so, how?

感情迁移 提交于 2019-12-06 18:30:02
问题 I have a managed assembly that gets called via COM Interop. Like a VBScript client, a Perl client, and so on. The classes are decorated with [ClassInterface(ClassInterfaceType.AutoDual)] [GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d0000E")] [ComVisible(true)] Then of course I do the regasm thing, and all the methods work just fine. But there are also enum types in the assembly. I'd like to use symbolic names COM applications, for the enum values. How do I expose the enums via COM interop?

Registration free activation of native COM (activex) component from .NET

廉价感情. 提交于 2019-12-06 18:04:28
问题 I have a native dll (which is an activex control) that I need use with my .NET application without having to register the dll in the registry. I have read several in depth posts about registration free activation, some of the better ones are A lengthy one from Steve White and Leslie Muller This one from samuel jack And another from Mike Makarov and from what I can see it is possible. However several hours and hundreds of tests later I just cant get it to work. I've done a bit of PInvoking and

Fatal error on Custom WebBrowser (winforms) code

我们两清 提交于 2019-12-06 17:15:41
问题 Getting a fatal exception on the CustomWebBrowser (winforms) code. “ The runtime has encountered a fatal error. The address of the error was at 0x6c9a60c6, on thread 0xf94. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack. ” This is working fine on machines that has .Net Framework 4.5 installed, however not

Calling COM visible managed component from managed code through COM wrapper

纵饮孤独 提交于 2019-12-06 17:15:14
问题 I have a 3rd party component, lets say FIPreviewHandler to handle preview, which implements IPreviewHandler. FIPreviewHandler is implemented as a Managed Component, and uses the IPreviewHandler interface and related interfaces through means of an interop. FIPreviewHandler is registered using regasm.exe as COM. I have a client application which is also Managed. I want to create an instance of FIPreviewHandler as a COM component in my application. I have an interop assembly that defines