Can you post your workbook or code in its entirety?
Regards,
Simon
Can you post your workbook or code in its entirety?
Regards,
Simon
Unfortunately, I don't have the rights to post it.
The key maybe under protection though... maybe a workaround could be done?
Situation right now is, under the protect sheet option :
Everything unchecked except "Select unlocked cells"
-> that works on every sheets but one. but on the PC setted differently (English), works everywhere! I mean, the cursor changes to an hand (showing a macro is assigned) even if there is no macro assigned, but on the other working PC, the cursor is a plus sign (apparently no macros assigned)...
Them, if I check the "edit objects" on that problematic sheet
-> now the macro isn't called anymore but the user can drag and resize the objects on the sheet, wich is less of a problem but still not good.
So when we uncheck "edit objects", the sheet is assigned a macro (quitting procedure) to everywhere on the sheet that doesn't have a macro already assigned to it.
This is really odd...
Thanks for your help!
I dont understand, if, as i suggested earlier you did view and check the modules for the change event then you have the capability to copy the code to here, its a straight highlight of the code and then paste into your message window!
regards,
Simon
Last edited by Simon Lloyd; 10-18-2006 at 11:15 AM.
Hi Simon,
The point is there is no code at all on the sheet that cause problem (no Worksheet_Change, Worksheet_SelectionChange...)
There is code in the some other sheets for those events though. I've put breakpoints in every events of every sheets: it doesn't enter any events! It goes directly in that module's procedure. That's why I don't think posting the code would make a difference, but here it is anyway.
Code in a sheet looks like that:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrHandler
Const LOCATION As String = NOM_MODULE & "(Worksheet_Change)"
Application.EnableEvents = False
Call TestDataEtape1(Target.Row(), Target.Column(), m_intDureeAncien)
Application.EnableEvents = True
'Si Première année d'analyse
If Range(VAR_ET1_TXT_PREMIERE_ANNEE_ANALYSE).Address = Target.Address Then
'MAJ l'année d'actualisation et l'année retenue pour les $ constant
Range(VAR_ET1_TXT_PREMIERE_AN_RETENUE_ACTUALISATION) = Target.Value
Range(VAR_ET1_TXT_PREMIERE_AN_RETENUE_DOL_CONSTANTS) = Target.Value
G_iModification = 1
End If
Exit Sub
ErrHandler:
LogErr_Continu LOCATION, "CIP: " & g_strUserNameNT
End Sub
'************************************************************************************************************
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
m_intDureeAncien = Range(VAR_ET1_TXT_PREMIERE_DUREE_ANALYSE).Value
End Sub
And the procedure that is called directly is:
Sub QuitterApplication()
On Error GoTo Err_Header
Const LOCATION As String = NOM_MODULE & "(QuitterApplication)"
strActiveSheet = ActiveSheet.Name
Application.ScreenUpdating = False
IndAnnulerEnregistrer = False
If ExistanceFichier(sNameFile) = True Then
reponse = MsgBox(QST_PROJETOUVERT_ENREGISTREMENT, vbQuestion + vbYesNoCancel, "Enregistrer le projet?")
If reponse = vbYes Then
Call EnregistrerSous
End If
'**************************************************************************************
'Ajout pour supprimer la double confirmation de sauvegarde
If reponse <> vbCancel Then
Workbooks(sNameFile).Saved = True
Workbooks(sNameFile).Close
End If
'Remplace
'**************************************************************************************
'If reponse <> vbCancel Then Workbooks(sNameFile).Close
'**************************************************************************************
If reponse = vbCancel Then IndAnnulerEnregistrer = True
End If
If IndAnnulerEnregistrer = True Then
Workbooks(Sheets("Parametres").Cells(1, 1).Value).Activate
Sheets(strActiveSheet).Select
Exit Sub
Else
Workbooks(Sheets("Parametres").Cells(1, 1).Value).Activate
Call InitialisationNomProjet("")
Call InitialisationEtape1
Sheets("Menu Principal").Select
Sheets("Menu Principal").Unprotect Password:=PASSWORD_PROTECTION
Sheets("Menu Principal").Range("varNomVariante").Value = ""
If Worksheets(1).DropDowns("varCboNomVariante").ListIndex <> 0 Then
Worksheets(1).DropDowns("varCboNomVariante").ListIndex = 0
End If
Sheets("Menu Principal").Protect Password:=PASSWORD_PROTECTION
Call AfficherEtapeNavigateur("Etape3", True)
Call AfficherEtapeNavigateur("Etape6", True)
Cells(1, 1).Select
Application.ScreenUpdating = True
Application.ScreenUpdating = False
End If
Application.OnKey "^{PGUP}"
Application.OnKey "^{PGDN}"
DetectionModificationDesactive
Workbooks(Sheets("Parametres").Cells(1, 1).Value).Activate
Sheets("Menu Principal").Select
Application.DisplayAlerts = False
Application.Quit
Exit Sub
Err_Header:
If Err.Number = 424 Then
Resume Next
End If
LogErr_Continu LOCATION, "CIP: " & g_strUserNameNT
End Sub
I really apreciate you trying to help. I think this has something to do with some windows settings because, as mentionned earlier, it doesn't cause that problem on every machine
THANKS!
Well i took a look, shame i cant understand french very well, i dont know if the windows environment can directly affect the excel worksheet, however you could try this in the quitter module
[vba]Const LOCATION As String = NOM_MODULE & "(QuitterApplication)"
If MsgBox("Do you really want to quit?", vbYesNo, "Quit Confirmation") = vbNo Then
Exit Sub
Else: 'THE REST OF THE CODE HERE'
End If[/vba]the coloured code is what i would have added to allow a choice before quitting!
regards,
Simon
Yeah, sorry about the french procedure names.
Your idea was not bad but the interaction with the user is not acceptable.
BUT you made me think of a solution, and it works!!!!
I've added an optional parameter to verify if the call to the procedure was an "authorized" one, and made it quit the procedure if it wasn't.
Sub QuitterApplication(Optional ValidCall As Boolean = False)
If Not ValidCall Then Exit Sub
Then for every call in the program, I just set the optional parameter to true:
QuitterApplication True
Et voilà!!!!!
That was weirdbut now the beast is finally under control!
Thanks!
Cool!, glad your sorted!
regards,
Simon
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks