Microsoft KB Archive/234732

= XL2000: "Subscript out of range" Error Programatically Saving Worksheet as Web Page =

Article ID: 234732

Article Last Modified on 10/10/2006

-

APPLIES TO


 * Microsoft Excel 2000 Standard Edition

-



This article was previously published under Q234732



SYMPTOMS
When you run a Microsoft Visual Basic for Applications procedure that utilizes the Htmlconvert method, you may receive the following error message:

Run-time error '9':

Subscript out of range



CAUSE
This error message occurs if you used Microsoft Excel 97 to create the procedure that contains the Htmlconvert method. In Excel 2000, the Visual Basic for Applications name of the Internet Assistant Wizard add-in changed from "Internet Assistant Wizard" to "Internet Assistant VBA".



RESOLUTION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers 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 requirements. The following Visual Basic Sub procedure illustrates how to work around the problem. You can use the Version property of the Application object to determine the version of Excel that you are running. Then, after you know the current version of Excel, you can use the correct name for the wizard. This procedure works in Excel 97 and Excel 2000: Sub CreateWebPage Dim objtoconvert(0) As Variant Dim WizardName As String ' If you are running Excel 2000... If Application.Version Like "9.0" Then ' Use the new name for the wizard. WizardName = "Internet Assistant VBA" Else ' Use the old name for the wizard. WizardName = "Internet Assistant Wizard" End If   Set objtoconvert(0) = Sheets("sheet1").Range("a1:b2") 'Use the variable defined above for the name fo the wizard. AddIns(WizardName).Installed = True htmlconvert objtoconvert, False, False, False, 1252, "c:\test.htm", _ "Test Page", True, "Myname" End Sub

Additional query words: XL2000 html.xla

Keywords: kbdtacode kberrmsg kbprb KB234732

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.