Solved

Excel (DDE) problem

Posted on 2001-07-18
6
6,050 Views
Last Modified: 2010-04-07
Hi,
I have an application that uses Excel.
I open an excel worksheet in a picturebox to work with. (To avoid the excel toolbars and other options I disable those options in VB).
The problem is, that when I open another excel sheet (not linked to my application, e.g. Test.xls) the sheet will open in my application too (in my picturebox without the toolbars etc...).
I've noticed that when the DDE option in the File Type of excel workbook is checked off, this doesn't
occur. (in browser, tools, folder options, file type, excel worksheet ,edit the "open" possibility).

Is there a way to disable this DDE option in VB?

Note: When I open excel first and then I load a .xls file, it doesn't occur. It's only when I double click on a .xls file that it will open in my application (when it's running of course)

Hope somebody can help.
Catouch
0
Comment
Question by:Catouch
6 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 150 total points
Comment Utility
Catouch, you could do this by editing the registry within your VB application. The check box that you set as described actually influences the registry. The following process using a registry class or api calls should achieve your desired aim:

Open the key \HKEY_CLASSES_ROOT\Excel.Sheet\CurVer\(Default) this will give you the current version of excel that is installed on the system, for example Excel.Sheet.8

Then open the key \HKEY_CLASSES_ROOT\<Value Returned Form Previous Call>\shell\Open\ddeexec\(Default) and set the value to "". This will stop the dde command being sent to Excel, you can then reset it to [open("%1")] later to re-enable the dde command.

Obviously as this is a registry hack it should be done carefully and you should test it thoroughly on a backed up machine before putting it out anywhere else.
0
 
LVL 22

Expert Comment

by:CJ_S
Comment Utility
DDE -> Dynamic Data Exchange
It is used to operate another program that is alrewady open. You can retrieve variable etc, as long as they have been set by the programmer. What do you mean by disabling DDE for VB? As long as the LinkMode is set to "none" DDE cannot be used with your application.

regards,
CJ
0
 
LVL 22

Expert Comment

by:CJ_S
Comment Utility
I probably just misunderstand the question though..
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 1

Author Comment

by:Catouch
Comment Utility
It is the good solution TimCottee thanks.
Only one strange thing is going on.
The excel opens up when I double click on the Test.xls, but the Worksheet does not open.
I have an empty Excel.
When I then goto file open, i have my sheet.
Is this some other registry setting?
I'm granting you the points anyway, cause you found what I asked for, but do you know how I can fix this?
0
 
LVL 1

Author Comment

by:Catouch
Comment Utility
ok, got it. it's the %1 param that has to be added.
Thanks TimCottee
0
 

Expert Comment

by:Alon_h
Comment Utility
try this ...

put excel file in "c:\excel\book1.xls"

and then run this code from word...


   Sub Main
      Q$ = Chr$(34)
      ' Initiate DDE conversation using System topic
      Channel = DDEInitiate("EXCEL", "System")
      ' Open workbook file
      DDEExecute Channel, "[OPEN(" + Q$ + "C:\EXCEL\BOOK1.XLS" + Q$ + ")]"
      ' Initiate DDE conversation using open workbook file
      Channel2 = DDEInitiate("excel", "C:\EXCEL\BOOK1.XLS")
      ' Insert data in workbook
      DDEPoke Channel2, "R1C1", "Total: $1,434"
      DDETerminate Channel
      DDETerminate Channel2
   End Sub


0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now