Solved

Excel (DDE) problem

Posted on 2001-07-18
6
6,215 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 150 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…

734 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