Results 1 to 6 of 6
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Userform in template... (2000 sr 1)

    i have a mcro (attached) to cut and paste a range from PADI_OK.xls master wbook to TEMPLATE.xls (used for all wbook created).
    But prob...
    Into TEMPLATE i have insert into event wbook_open the command to show a userform when the wbook is opened: Call ShowUserform1
    Now, when i open the TEMPLATE naturally is show the userform and the macro go in error because with the uiserform showed not permit the paste of range from master to template...
    How to solve the error?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Userform in template... (2000 sr 1)

    You could insert a line somewhere at the beginning of the code:

    If InStr(ActiveWorkbook.Name, "TEMPLATE") > 0 Then Exit Sub

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Userform in template... (2000 sr 1)

    ... not completly uderstrand....:-(

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Userform in template... (2000 sr 1)

    I don't completely understand your question either... <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Userform in template... (2000 sr 1)

    First, sorry for delay...

    Explain:
    This part of code open from a server dir the TAMPLATE_PADI.xls.

    ....................
    Set wrk = Workbooks.Open("GCD01F4500DATIPUBBLICAINPSTEMPLATE _PADI")
    wrk.SaveAs "GCD01F4500DATIPUBBLICASTORICO_PADI" & strNomeFile & "_" & "PADI" & "_" & strData & ".xls"
    ActiveSheet.Unprotect PASSWORD:="SAL21"

    rng.Copy ActiveWorkbook.Sheets(1).Range("A3")
    rng1.Copy ActiveWorkbook.Sheets(1).Range("N3")

    Sheets("TEMPLATE").Range("G1").Value = CDate(gg & "/" & mm & "/" & AA)

    Call CHIUDI_COLONNE
    Call MSTUTTO
    'Call LOCK_CELLS

    ActiveSheet.Name = strNomeFile

    wrk.Save
    .................

    And i use this wbook for all creation of other wbook, with a range of cell from MASTER.xls.
    Naturally if i use into event open wbook in TAMPLATE_PADI.xls: call shouserform1.show, the userform is show in front when the TAMPLATE_PADI.xls is opened, and the macro not permit the pasting of cells...

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Userform in template... (2000 sr 1)

    Open the ThisWorkbook module.
    Insert the line I mentioned at the beginning of the Workbook_Open event procedure:

    Private Sub Workbook_Open()
    If InStr(ActiveWorkbook.Name, "TEMPLATE") > 0 Then Exit Sub
    ' rest of the code
    ...
    End Sub

Posting Permissions

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