XL2000: “Run-Time Error ‘4599’” Running DDE Macro to Control Excel

Symptoms  –

When you use dynamic data exchange (DDE) to control Microsoft Excel from another program, you see the following error message when you try to rename a sheet in a workbook:

Run-time error ‘4599’:
Process failed in other application.

When you activate Microsoft Excel after the error message appears, the sheet tab is selected as if you are ready to change it.

Cause – 

This error occurs when you are trying to rename a sheet by using the DDEExecute method withWorkbook.Name() as the command in a Microsoft Visual Basic for Applications procedure or macro from another program.

Resolution – 

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs.
If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites:

Microsoft Certified Partners – https://partner.microsoft.com/global/30000104

Microsoft Advisory Services – http://support.microsoft.com/gp/advisoryservice

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS If the application supports Automation, it is recommended that you use Automation to control Microsoft Excel instead of DDE.

To work around this behavior by using DDE, write a Visual Basic procedure or macro in Microsoft Excel to rename the sheet and have the DDE procedure run the Microsoft Excel procedure or macro to change the sheet name.

The following example uses Microsoft Word as the program that contains the DDE macro that controls Microsoft Excel. It assumes that you are initiating a DDE channel to an existing workbook (“Book1.xls”) and you are changing “Sheet1” to “New.”

  1. Start Microsoft Excel.
  2. Save the new workbook as Book1.xls.

    Make sure that a sheet named Sheet1 exists.

  3. Press ALT+F11 to start the Visual Basic Editor.
  4. On the Insert menu, click Module.
  5. Type the following code in the new module sheet:
    Sub Change_Name()
       Sheets("Sheet1").Name = "New"
    End Sub
  6. On the File menu, click Close and Return to Microsoft Excel.
  7. On the File menu, click Save. (Do not close Book1.xls.)
  8. Leaving Microsoft Excel open, start Microsoft Word.
  9. In Word, press ALT+F11. In the Visual Basic Editor, on the Insert menu, click Module.
  10. Type the following code in the new module sheet:
    Sub DDE_to_XL()
    
       ' Opens a DDE channel to Book1.xls in Microsoft Excel.
       Chan = DDEInitiate(App:="Excel", Topic:="book1.xls")
    
       ' Sends a DDE command to Microsoft Excel to run the
       ' Change_Name macro.
    
       DDEExecute Channel:=Chan, Command:="[Run(" & Chr(34) & _
                 "Change_Name" & Chr(34) & ")]"
    
       ' Closes the DDE channel to Book1.xls in Microsoft Excel.
       DDETerminate Channel:=Chan
    
    End Sub
  11. On the File menu, click Close and Return to Microsoft Word.
  12. On the Tools menu, point to Macro, and then click Macros. In the Macros dialog box, click DDE_to_XLand then click Run.

    After the macro runs, “Sheet1” should be changed to “New” in the workbook.

For additional information about getting help with Visual Basic forApplications, click the article number below to view the article in the Microsoft Knowledge Base:

226118  OFF2000: Programming Resources for Visual Basic for Applications
Applies to – 
  • Microsoft Excel 2000 Standard Edition
    1. For any questions, queries please do not hesitate to leave a comment in the queries page at the bottom of the page or contact us at compfaqz@gmail.com

      Join us on facebook

      http://www.facebook.com/pages/Compfaqz/178832208817415

One response to “XL2000: “Run-Time Error ‘4599’” Running DDE Macro to Control Excel

  1. Pingback: Pack Pro | Carbzine Paintball

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s