+ Reply to Thread
Results 1 to 10 of 10

Macros link problem?

Hybrid View

SuperDude99 Macros link problem? 10-16-2006, 03:12 PM
Simon Lloyd The procedure is being called... 10-16-2006, 09:14 PM
SuperDude99 Thanks for your response... 10-17-2006, 01:30 PM
Simon Lloyd Can you post your workbook or... 10-17-2006, 01:35 PM
SuperDude99 Unfortunately, I don't have... 10-18-2006, 09:46 AM
Simon Lloyd I dont understand, if, as i... 10-18-2006, 11:13 AM
SuperDude99 Hi Simon, The point is... 10-18-2006, 11:45 AM
Simon Lloyd Well i took a look, shame i... 10-18-2006, 02:19 PM
SuperDude99 Yeah, sorry about the french... 10-18-2006, 03:19 PM
Simon Lloyd Cool!, glad your sorted! ... 10-19-2006, 02:17 AM
  1. #1
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Can you post your workbook or code in its entirety?

    Regards,
    Simon

  2. #2
    Registered User
    Join Date
    10-16-2006
    Posts
    5
    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!

  3. #3
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    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.

  4. #4
    Registered User
    Join Date
    10-16-2006
    Posts
    5
    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!

  5. #5
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    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

  6. #6
    Registered User
    Join Date
    10-16-2006
    Posts
    5
    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 weird but now the beast is finally under control!

    Thanks!

  7. #7
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Cool!, glad your sorted!

    regards,
    Simon

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1