Domenico
You must not be using Option Explicit at the top of your modules. I spotted a misspelling that might be the cause. Using Option Explicit will show all undeclared variables which will make debugging easier. While in the VBA editor go to Tools>Options>Require Variable Declaration. That will add Option Explicit to all new modules. But you will have to manually add it at the top of each existing modules. The very top should look like this:Option Compare DatabaseOption ExplicitThe typo is in this line:Open Application.CurrentProject.Path & "\ rbnProcedure" & suf & ".txt" For Input As lngDate Note lngDate is used instead of your declared variable lngDatei.That might not be what is causing your problem, but it is a good place to start.Regards,Bill Mosca,Founder, MS_Access_ProfessionalsThat'll do IT http://thatlldoit.comMS Access MVPMy Nothing-to-do-with Access blog
---In MS_Access_Professionals@yahoogroups.com , <domcoz@gmail.com> wrote :So long ago I opened a discussion on the access ribbon,
I noticed that my access application (access 2007) in Access 2016
the ribbon did not appear. Then I did a lot of tests and I was able to understand why.
structure:
I have two txt files
RbnProcudure.txt <- Italian menu
RbnProcudure_EN.txt <- english menu
In Access 2007 I have the following procedure that runs in Autoexec:
Public Sub LoadRibbons_Setting ()
Dim Suf As String
Dim lngDatei As Long
Dim strText1 As String
Suf = ""
If TempVars ("Language"). Value = "ENG" Then
Suf = "_EN"
End If
LngDatei = FreeFile
Open Application.CurrentProject.
Path & "\ rbnProcedure" & suf & ".txt" For Input As lngDate StrText1 = Input $ (LOF (1), lngDatei)
Close lngDate
Application.LoadCustomUI "rbnStart", strText1
End Sub
And in the Option Database -> Current Database I have set the ribbon name with: rbnStat.
And so it works perfectly !!
In Access 2016 does not work .. but if I change
Application.LoadCustomUI "rbnStart", strText1
with
Application.LoadCustomUI "rbnProcedure", strText1 or
Application.LoadCustomUI "rbnProcedure_EN", strText1
And obviously in the Option Database the ribbon name change in rbnProcedure or rbnProcedure_EN the program works well.
Strangely, for me, the name of the .txt file must be the same as the name to be assigned to the ribbon with the application.LoadCustomUI instruction.
I have changed the procedure in:
Public Sub LoadRibbons_Setting ()
Dim Suf As String
Dim lngDatei As Long
Dim strText1 As String
Suf = ""
If TempVars ("Language"). Value = "ENG" Then
Suf = "_EN"
End If
FileCopy Application.CurrentProject.
Path & "\ rbnProcedure" & Suf & ".txt", _ Application.CurrentProject.
Path & "\ rbnProcedure.txt"
LngDatei = FreeFile
Open Application.CurrentProject.
Path & "\ rbnProcedure" & suf & ".txt" For Input As lngDate StrText1 = Input $ (LOF (1), lngDatei)
Close lngDate
Application.LoadCustomUI "rbnProcedure", strText1
End Sub
And of course in the Option Database set name database ribbon option in: rbnProcedure
everything and went back to working properly.
I can not understand why?
I apologize if I was not clear
Domenico
Posted by: Domenico Cozzolino <domcoz@gmail.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (3) |
Tidak ada komentar:
Posting Komentar