Link to home
Start Free TrialLog in
Avatar of Catouch
Catouch

asked on

Excel (DDE) problem

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
ASKER CERTIFIED SOLUTION
Avatar of TimCottee
TimCottee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
I probably just misunderstand the question though..
Avatar of Catouch
Catouch

ASKER

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?
Avatar of Catouch

ASKER

ok, got it. it's the %1 param that has to be added.
Thanks TimCottee
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