ole

HOW TO close Excel instance started by mail merge

送分小仙女□ 提交于 2019-12-20 04:32:52
问题 HOW TO close Excel instance started by mail merge this code running inside launcher does not have access to Excel running via DDE ?? 'For i = 1 To Workbooks.Count ' MsgBox ("here" + Workbooks(i).Name) 'If (Workbooks(i).Name <> ActiveWorkbook.Name) Then 'Workbooks(i).Close 'End If 'Next i 回答1: You can kill the excel process like so: (from http://www.dreamincode.net/code/snippet1543.htm) //Namespaces needed using System.Diagnostics; public bool FindAndKillProcess(string name) { //here we're

How to cast OleVariant to IDispatch derived?

醉酒当歌 提交于 2019-12-20 04:07:35
问题 I bring today another question that is burning my head, I do import a DAO 3.6 type library to my delphi 7, and I start to see many interesting intefaces so I face on intriguing question. Every time the class Fields appears on property of another class, they have the right definition, I mean, he is defined as Fields, but in Index class, in the parts where he describes all fields participants of his structure, the property fields appears not as Fields, but as OleVariant. Look at the diference

Getting an IStream from an OleVariant

时光毁灭记忆、已成空白 提交于 2019-12-20 02:10:50
问题 I am using Delphi along with WinHTTP to do an HTTP request to download some files from the internet, and I can do the request but I don't know how to get the IStream from the OleVariant that is returned from ResponseStream . I have spent a lot of time googling but I can't figure out how to do it. Here is what I have tried: var req: IWinHTTPRequest; instream: IStream; begin req := CoWinHTTPRequest.Create; req.Open('GET', 'http://google.com', false); req.Send(''); if req.Status <> 200 then

Unspecified error when calling Word CentimetersToPoints via OLE

狂风中的少年 提交于 2019-12-19 21:52:32
问题 The following code fails with an OLE 800040005 "unspecified" error on the CentimetersToPoint call when executed in Delphi (XE), the similar VBS or VBA version passes var w : OleVariant; w := CreateOleObject('Word.Application'); w.Visible := true; Writeln(w.CentimetersToPoints(2.0)); FWIW the type library gives / [id(0x00000173), helpcontext(0x09700173)] // single CentimetersToPoints([in] single Centimeters); By default, Delphi only passes the floating values as Double, so I tried calling

“Unable to recognize OLE stream” excepion while connecting to Excel

可紊 提交于 2019-12-19 03:25:48
问题 I was trying to connect my Java program with an Excel file. I have did upto this. But it throws this excepion Unable to recognize OLE stream Please, help me to complete this. import jxl.*; import java.io.*; public class excel { public static void main(String[] args)throws Exception { File ex=new File("D:/worksps/test.xlsx"); Workbook w= Workbook.getWorkbook(ex); Sheet s= w.getSheet(0); for(int i=0;i<s.getColumns();i++) { for(int j=0;j<s.getRows();j++) { Cell cell=s.getCell(i, j); System.out

Save as an Excel file embedded in another Excel file

雨燕双飞 提交于 2019-12-18 09:17:22
问题 I want to manage with VBA an Excel file embedded in another Excel file. I can find many results with .docx documents, but I stuck with a .xlsx one. My last try is using OLE objects, but stuck at the line "SaveAs" (Error 1004). Here is the weird part: when I start debugging, or if I run the program step by step using F8, it did run, but no file were saved... I called my OLEObject "TEST" for this example: Sub testOLE() mPath = ActiveWorkbook.Path For Each obj In Worksheets(1).OLEObjects If obj

Converting an OLE Image Object from MS Access for use in .NET

半城伤御伤魂 提交于 2019-12-18 08:01:11
问题 I'm working on redeveloping an Access based system into c#.net, however when MS went from office 2003 to office 2007 they removed the picture editor within access - which meant that previously stored pictures would no longer display in the system. The guys at the company did a hack that basically saved the images with VBA using excel in the background (I can get more information if you need it) but basically it meant the access image controls could still be used (Object bound frames). However

Implementing drag-drop from Chrome on my .NET Windows form

会有一股神秘感。 提交于 2019-12-17 23:07:28
问题 Google Chrome has a handy feature where I can click a download link and drag it into a Windows Explorer window, and then drop. After dropping, Chrome then downloads the file and it appears where I dropped it. I would like to be able to drop from Google Chrome into my application, but it seems it isn't so simple. I have a DataGridView called gridFiles, and the following code: Private Sub gridFiles_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles gridFiles

Build Warnings Related to COM Reference (Version 1.0 Type Library) and VS 2010

亡梦爱人 提交于 2019-12-17 20:50:46
问题 I just finished restructuring and upgrading a bunch of C# projects from Visual Studio 2008 to Visual Studio 2010. Additionally, all of the projects were changed to target the .NET 4.0 runtime. Everything builds successfully but, I now get a bunch of warnings related to a COM reference that my application is dependent upon. One of the warnings is below. I get close to 100 warnings similar to the one below everytime I build the solution. Warning 60 Type library importer encountered a property

how to create an ole object from a file - Ms-access

无人久伴 提交于 2019-12-17 20:41:16
问题 I have a table with an embedded picture(OLE) coulmn. I Want to be able to insert a new record via a form with a browse option. Anyway, I have a file name, And I need to turn it into an ole object and insert it into the form. how do I do that in VBA? To clarify - I need to turn a file name, into an ole object with that file, and than insert it into the table. Thanks, Fingerman. EDIT: Ok, as pointed out by @HansUp I need to explain. In my form, I have a bound OLE object that is not bound to a