?
Solved

Excel (DDE) problem

Posted on 2001-07-18
6
Medium Priority
?
6,277 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 600 total points
ID: 6293630
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
ID: 6293651
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
ID: 6293652
I probably just misunderstand the question though..
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:Catouch
ID: 6293686
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
ID: 6293717
ok, got it. it's the %1 param that has to be added.
Thanks TimCottee
0
 

Expert Comment

by:Alon_h
ID: 6294925
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month11 days, 1 hour left to enroll

770 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