Aeraphe / xvba-repo

VBA Repository
48 stars 5 forks source link

Files Imported from/to Access database not placed in specified vba_folder #16

Open fabrizionastri opened 1 year ago

fabrizionastri commented 1 year ago

Issue Description: When using the "XVBA - Live Server VBA" to edit VBA code for an Access database, the files aren't placed in the directory specified in the config.json file: "vba_folder": "vba-files".

Steps to Reproduce:

  1. Open VS Code and install "XVBA - Live Server VBA" in VSCode (v4.0.30)
  2. Create a new project folder : C:\Users\<USERNAME>\Repos\\MSAccess-XVBA-Test
  3. In the XVBA extension menu in the VSCode activity bar, click on "Boostrap XVBA Config" to create a new project, and select "Create Access Project" image
    • This will created the following files and folders in the project root: image
    • with the following config.jsonfile:
      {
      "app_name": "XVBA",
      "description": "",
      "author": "",
      "email": "",
      "create_ate": "Mon Aug 28 2023 11:45:21 GMT+0200 (Central European Summer Time)",
      "excel_file": "index.accdb",
      "vba_folder": "vba-files",
      "ribbon_file": "customUI14",
      "ribbon_folder": "ribbons",
      "logs": "on",
      "xvba_packages": {},
      "xvba_dev_packages": {}
      }
  4. Ensure the vba-files directory exists in the root folder of the repo and is empty.
  5. Open the "index.accdb" database, and create a new modul with a VBA subroutine, for example:

    Sub TestFromAccess1()
    
    MsgBox "TestFromAccess1"
    
    End Sub
  6. In the XVBA extension menu in the VSCode activity bar, click on "Import - VBA" to import the code from Access
  7. Observe that the imported files aren't placed in the vba-files directory.
  8. Check the logs\excel_import.log file and find the following line: "28/08/2023 12:56:50 - DEBUG:Export VBA files from Access to C:\Users\\AppData\Local\Temp\xvba_files finished. ".
  9. Go to that directory, and observe that the files are not there, but instead are located in "C:\Users\\AppData\Local\Temp" image
  10. Go back to VSCode, create a new file with new sub (eg. TestFromVSCode2") and save it: image
  11. In the XVBA extension menu in the VSCode activity bar, click on "Export VBA" to export this code to Access, and select "Build" (the other 2 options and give the same result) image
  12. Go back to Access and open the VBA Editor (Alt+F11), and note that the previous code with TestFromAccess has disappeared, and has been replaced by the new one from VSCode. image
  13. This code runs successfully when launched from within Access, but not when launched within VSCode

Expected Behavior: The VBA files should be imported from Access to the vba-files directory in VSCode as specified in config.json. Any changes made there should then be exported back to the Access database


Actual Behavior: The VBA files are imported in C:\Users\<USERNAME>\AppData\Local\Temp folder instead of vba-files directory.


Additional Information:

word-x commented 1 year ago

I got the same issue.

When I tried to import VBA code from Excel, the .bas file was not generated in vba-files folder. It was placed in: C:\Windows\Temp\xvba_files.

It should be generated in project_folder/vba-files.

Environment: 1.Win10, Office 2019 2.Latest VS code (I downloaded today)

Snipaste_2023-09-12_06-26-34 Snipaste_2023-09-12_06-27-17

word-x commented 1 year ago

@fabrizionastri Did you fix it? It seems a bug. I've tried various versions of this extension, it has the same issue. Very appreciated if someone could give me a hint.

fabrizionastri commented 1 year ago

No I did not fix it.

@Aeraphe : Hello, are you aware of this issue ? Are you still mainting this extension ? I would appreciate any help.

Zimbaner commented 7 months ago

@word-x @fabrizionastri Did you fix it? I've the same problem.