Log in

View Full Version : Problem initializing excel from Visual Basic IDE



alexfc
02-08-2012, 04:07 AM
Hi there!

I am trying to initialize excel aplication from visual basic and then input some data.BUT im guetting an error (that i guess has to do with my previlegies in the PC).Im working with this language now in my new job,and i have some issues with previlegies there.

HERE IS THE CODE:

Option Compare Database

Private Sub Main()
Dim xl As New Excel.Application
Dim xlw As Excel.Workbook
Set xlw = xl.Workbooks.Add 'HERE I GET THE ERROR
xl.Visible = True
End Sub
so the error message is "this feature is not available.For more info,contact the system`s admin"

Do you know what kind of error is this?what can i do to fix it?

Norie
02-09-2012, 04:57 AM
Try this instead.

Private Sub Main
Dim xl As Excel.Application
Dim xlw As Excel.Workbook

Set xl = New Excel.Application

Set xlw = xl.Workbooks.Add

xl.Visibel = True
End Sub


Or instead of using New:

Set xl = CreateObject("Excel.Application")