none
Problem initializing excel from Visual Basic IDE RRS feed

  • Question

  • 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?

    Wednesday, February 8, 2012 11:00 AM

Answers

  • Hi Alexfc,

    Are you saying at "tools->reference->Microsoft Excel
    9.0 Object Library"? so YES.I guess the problem is about previlegies
    in the computer...could be?

    Yes. Odd error. I would start by doing a detect and repair in Office setup (control panel). I suspect a problem with your Office installation.


    Regards, Jan Karel Pieterse|Excel MVP|http://www.jkp-ads.com
    Wednesday, February 8, 2012 3:00 PM

All replies

  • Hi Alex,

    It is better to modify your code to:

    Private Sub Main()

    Dim xl As Excel.Application
    Dim xlw As Excel.Workbook
      Set xl = New Excel.Application
      Set xlw = xl.Workbooks.Add
      xl.Visible = True  End Sub


    Regards, Jan Karel Pieterse|Excel MVP|http://www.jkp-ads.com
    Wednesday, February 8, 2012 11:16 AM
  • Hi Alex,

    It is better to modify your code to:

    Private Sub Main()

    Dim xl As Excel.Application
    Dim xlw As Excel.Workbook
      Set xl = New Excel.Application
      Set xlw = xl.Workbooks.Add
      xl.Visible = True  End Sub


    Regards, Jan Karel Pieterse|Excel MVP|http://www.jkp-ads.com

    Hi Jan,

    I did that..now i get the followed error : Run-Time error 48,error in loading DLL.

    any suggestion?

    at least the error message changed,lol

    Wednesday, February 8, 2012 11:24 AM
  • Does Excel work on your machine at all?


    Regards, Jan Karel Pieterse|Excel MVP|http://www.jkp-ads.com
    Wednesday, February 8, 2012 12:36 PM
  • Yes...Excel is installed and working fine in my machine.I tried many ways but cant find a solution.

    PS:Access isnt installed in my machine,im using it from a virtual application.The same error occurs when I try to open any other office program like Word or Power Point using visual basic code.

    Wednesday, February 8, 2012 12:41 PM
  • Have you referenced Excel in the VBA project?


    Regards, Jan Karel Pieterse|Excel MVP|http://www.jkp-ads.com
    Wednesday, February 8, 2012 2:00 PM
  • Have you referenced Excel in the VBA project?


    Regards, Jan Karel Pieterse|Excel MVP|http://www.jkp-ads.com
    Are you saying at "tools->reference->Microsoft Excel 9.0 Object Library"? so YES.I guess the problem is about previlegies in the computer...could be?
    Wednesday, February 8, 2012 2:49 PM
  • Hi Alexfc,

    Are you saying at "tools->reference->Microsoft Excel
    9.0 Object Library"? so YES.I guess the problem is about previlegies
    in the computer...could be?

    Yes. Odd error. I would start by doing a detect and repair in Office setup (control panel). I suspect a problem with your Office installation.


    Regards, Jan Karel Pieterse|Excel MVP|http://www.jkp-ads.com
    Wednesday, February 8, 2012 3:00 PM
  • Hi Alexfc,

    Are you saying at "tools->reference->Microsoft Excel
    9.0 Object Library"? so YES.I guess the problem is about previlegies
    in the computer...could be?

    Yes. Odd error. I would start by doing a detect and repair in Office setup (control panel). I suspect a problem with your Office installation.


    Regards, Jan Karel Pieterse|Excel MVP|http://www.jkp-ads.com
    I'll try to do this.Thanks for the help.If anyone has any other ideia,please tell me.
    Wednesday, February 8, 2012 3:57 PM