Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't create Excel ActiveX component

Status
Not open for further replies.

rcarr

Programmer
Oct 19, 2000
12
0
0
CA
When the user clicks a button I want to create an instance of Excel and display the Open dialog box set to a specific subdirectory. This will give the user a choice of opening one of many spreadsheets in this directory. When I run the following code (the user clicks button1) I get the error, "ActiveX component can't create object :'Excel.Application'". What am I missing?

<SCRIPT LANGUAGE=vbscript>
<!--
Sub button1_onclick()
Set oExcel = CreateObject(&quot;Excel.Application&quot;)
oExcel.Visible = True
Set fd = oExcel.FileDialog(msoFileDialogFilePicker)
fd.InitialFileName = &quot;\\cc-nts2\data\accounting\&quot;
fd.Filters.Add &quot;*.xls&quot;, &quot;*.xls&quot;, 1
fd.FilterIndex = 2
fd.AllowMultiSelect = False
If fd.Show = -1 Then
oExcel.Workbooks.Open fd.SelectedItems(1)
End If
Set fd = Nothing
Set oExcel = Nothing
End Sub
-->
</SCRIPT>
Randy Carr
randy.carr@carteretcraven.ncemcs.com
 
OK, I set the security settings to low for this site and it created the Excel object. Now it hangs up on the line &quot;Set fd = oExcel.FileDialog(msoFileDialogFilePicker)&quot;. Anyone have an idea why?
Randy Carr
randy.carr@carteretcraven.ncemcs.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top