Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    May 2001
    Omaha, NE USA, Nebraska, USA
    Thanked 0 Times in 0 Posts

    DialogSheets, adding controls (Excel 2007 SP1 MSO)

    I am in the process of reviewing all of my add-ins and macros to move them from Excel XP to Excel 2007. I came across this section of code that gives me a run-time error (the code that is highlighted is what is marked when I debug the run-time error). Any ideas on what is causing the problem and how to resolve it. This is a snippet of code in a procedure that will create a dialog sheet that lists all of the worksheeets in the workbook and allows the user to select which worksheets should be printed.

    <pre> ' Add text field to control number of copies to print
    TopPos = TopPos + 5
    PrintDlg.EditBoxes.Add 82, TopPos, 15, 18
    <span style="background-color: #FFFF00; color: #000000; font-weight: bold">PrintDlg.TextBoxes.Add 100, TopPos, 90, 18</span hi>
    TopPos = TopPos + 25
    PrintDlg.EditBoxes(1).Text = 1
    PrintDlg.TextBoxes(1).Text = "How many copies?"

    The RunTime Error message box reads; "Run Time Error '1004'; Add method of TextBoxes class failed"


  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 30 Times in 30 Posts

    Re: DialogSheets, adding controls (Excel 2007 SP1 MSO)

    Dialog sheets were deprecated in favor of userforms in Excel 95, some 13 years ago. They have been supported in later versions for compatibility reasons, but I think it's time to discard them, and create userforms instead.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts