GithubHelp home page GithubHelp logo

Comments (18)

ericremoreynolds avatar ericremoreynolds commented on June 17, 2024

Hello shends,
Could you please check if a folder called xlpython has been created in the same folder as your workbook, and if so whether it contains the file xlpython.bas?

from excelpython.

shends avatar shends commented on June 17, 2024

Thank you fro the fast response:)
Yes, so this is how it looks like
Computer > Local C> Project > xlpython folder & test.xlsm (workbook folder)
and inside the xlpython folder there is file xlpython.bas

from excelpython.

ericremoreynolds avatar ericremoreynolds commented on June 17, 2024

What error message is VBA giving? Can you attach a screenshot?

from excelpython.

shends avatar shends commented on June 17, 2024

This is the error message that I am getting right now.
screenshot_1

from excelpython.

ericremoreynolds avatar ericremoreynolds commented on June 17, 2024

Ok thanks, I am a bit confused however, because it is a different line from the one you mentioned, and also I cannot see any VBA error message.

You can see the VBA error message by typing ?Err.Description into the immediate window (the white box at the bottom of the screen)

from excelpython.

shends avatar shends commented on June 17, 2024

After I type in ?Err.Description, it says "It can not find the path"
Excel is not in English so it translated into... "It can not find the path"

My problem is when I click "Setup ExcelPython" button, it says..
"This action will:... Do you want to proceed?" and I answer "Yes" then the "76 runtime error" occurs.

from excelpython.

ericremoreynolds avatar ericremoreynolds commented on June 17, 2024

Ok, I see, please bear with me, can you please give me the output of the following in the immediate window:

?ThisWorkbook.Path

from excelpython.

ericremoreynolds avatar ericremoreynolds commented on June 17, 2024

I think the problem may be something to do with the characters (are they Chinese?). In fact I don't understand why it is showing a different character instead of a \ for example \xlpython. Is that normal?

from excelpython.

ericremoreynolds avatar ericremoreynolds commented on June 17, 2024

If the problem really is the \ character, maybe we can fix it by using Application.PathSeparator instead. Please let me know if replacing the relevant lines with the following VBA code works.

If fso.FolderExists(wb.Path + Application.PathSeparator + "xlpython") Then
    isVersionOK = False
    ver = "?.?.?"
    For Each f In fso.GetFolder(ThisWorkbook.Path + Application.PathSeparator + "xlpython").Files
        If LCase$(Right$(f, 4)) = ".dll" Then
            isVersionOK = fso.FileExists(wb.Path + Application.PathSeparator + "xlpython" + Application.PathSeparator + fso.GetFileName(f))
            ver = Mid$(fso.GetBaseName(f), InStr(fso.GetBaseName(f), "-") + 1)
            Exit For
        End If
    Next f
    If Not isVersionOK Then
        MsgBox "The installation folder already exists, but it does not contain ExcelPython version " + ver + "." _
            + vbCrLf + vbCrLf + "Installation folder: " + wb.Path + Application.PathSeparator + "xlpython" _
            + vbCrLf + vbCrLf + "To set up a fresh install please delete it and try again. Note that you may need to close Excel to delete it." _
            , vbCritical, "Error installing ExcelPython runtime"
        Exit Sub
    End If
Else
    fso.CopyFolder ThisWorkbook.Path + Application.PathSeparator + "xlpython", wb.Path + Application.PathSeparator + "xlpython"
End If

On Error GoTo not_present
wb.VBProject.VBComponents.Remove wb.VBProject.VBComponents("xlpython")
not_present:
On Error GoTo 0
wb.VBProject.VBComponents.Import wb.Path + Application.PathSeparator + "xlpython" + Application.PathSeparator + xlpython.bas"

' create skeleton py file
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists(wb.Path + Application.PathSeparator + fso.GetBaseName(wb.name) + ".py") Then
    Set f = fso.CreateTextFile(wb.Path + Application.PathSeparator + fso.GetBaseName(wb.name) + ".py", True)
    f.WriteLine "from xlpython import *"
    f.Close
End If

from excelpython.

shends avatar shends commented on June 17, 2024

Thank you for helping me out. I really apprecaite it.
So, when I type the following: "?ThisWorkbook.Path"
"C:\Project\xlpython"
This is the output file.

from excelpython.

ericremoreynolds avatar ericremoreynolds commented on June 17, 2024

ok i see, so you have unzipped the add-in in the folder c:\project\xlpython, i don't know if possibly this creates a problem when the setup tries to copy the c:\project\xlpython\xlpython folder to c:\project\xlpython.

try creating another folder c:\project2, saving a new workbook there and try again, so that way no conflicts are created

from excelpython.

shends avatar shends commented on June 17, 2024

So, after following your instruction, and clicking on SetupExcelPython button, the error occurs saying "76 runtime error" and when I debug it, the yellow line is on the following line
screenshot_2

from excelpython.

shends avatar shends commented on June 17, 2024

And when I uncommented that line, it successfully created test2.py file in c:\project2 folder. (yay!)
Wait, but is it ok to uncomment that line?

from excelpython.

ericremoreynolds avatar ericremoreynolds commented on June 17, 2024

Well... not really.
So I will explain, what the 'setup' button does is the following

  1. Copies the xlpython folder from the folder containing xlpython.xlam to the folder containing your workbook
  2. Imports the module xlpython\xlpython.bas into your workbook, thus creating the xlpython VBA module
  3. Creates the file test2.py with the line from xlpython import * to get you started.

So the first two steps are necessary for everything to work. If you have seen that the xlpython folder has been created, that the DLLs are in that directory, and you can import xlpython\xlpython.bas manually, then it will all work.

But I still can't understand why the add-in is failing unfortunately.

from excelpython.

ericremoreynolds avatar ericremoreynolds commented on June 17, 2024

Shends, do you have TeamViewer? If so I can give you remote assistance. You can send me the id/password by email.

from excelpython.

shends avatar shends commented on June 17, 2024

That would be great! Let me download TeamViewer right now. Where can I find your email?

from excelpython.

shends avatar shends commented on June 17, 2024

Thank you so much by following the
https://github.com/ericremoreynolds/excelpython/blob/master/docs/tutorials/AddinTrouble.md
I was able to solve my problem.:) Thank you

from excelpython.

ericremoreynolds avatar ericremoreynolds commented on June 17, 2024

Excellent I am glad to hear it, thank you for your interest in the project!

Eric.

from excelpython.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.