Applicazione macro



  • Applicazione macro
    di Fausto (utente non iscritto) data: 01/09/2010

    Ciao a tutti
    con il registratore di macro è stata creata la seguente macro:
    sub macroschedesicurezza()
    sheets("budget").select
    sheets("budget").copy before:=workbooks("pippo.xls").sheets(1)
    sheets("budget").select
    sheets("budget").name = "schede sicurezza"
    columns("c:z").select
    selection.delete shift:=xltoleft
    activesheet.pagesetup.printarea = ""
    range("a14:h57").select
    activesheet.pagesetup.printarea = "$a$14:$h$57"
    with activesheet.pagesetup
    .printtitlerows = "$14:$15"
    .printtitlecolumns = ""
    end with
    activesheet.pagesetup.printarea = "$a$14:$h$57"
    with activesheet.pagesetup
    .leftheader = "&""times new roman,grassetto""&14&a"
    .centerheader = ""
    .rightheader = "&""times new roman,grassetto""pag.&p"
    .leftfooter = ""
    .centerfooter = ""
    .rightfooter = ""
    .leftmargin = application.inchestopoints(0.3)
    .rightmargin = application.inchestopoints(0)
    .topmargin = application.inchestopoints(0.784251968503937)
    .bottommargin = application.inchestopoints(0.78110236220472)
    .headermargin = application.inchestopoints(0.511811023622047)
    .footermargin = application.inchestopoints(0)
    .printheadings = false
    .printgridlines = false
    .printcomments = xlprintnocomments
    .printquality = 300
    .centerhorizontally = true
    .centervertically = false
    .orientation = xlportrait
    .draft = false
    .papersize = xlpapera4
    .firstpagenumber = xlautomatic
    .order = xldownthenover
    .blackandwhite = false
    .zoom = 90
    .printerrors = xlprinterrorsdisplayed
    range("a14:b15").select
    with selection.font
    .name = "times new roman"
    .size = 10
    .strikethrough = false
    .superscript = false
    .subscript = false
    .outlinefont = false
    .shadow = false
    .underline = xlunderlinestylenone
    .colorindex = xlautomatic
    end with
    range("a14:a15").select
    selection.clearcontents
    range("a14:b15").select
    selection.merge
    range("a14:b15").select
    activecell.formular1c1 = "fase lavorativa"
    with activecell.characters(start:=1, length:=15).font
    .name = "times new roman"
    .fontstyle = "grassetto"
    .size = 10
    .strikethrough = false
    .superscript = false
    .subscript = false
    .outlinefont = false
    .shadow = false
    .underline = xlunderlinestylenone
    .colorindex = xlautomatic
    end with
    range("c1").select
    columns("b:b").columnwidth = 55.56
    columns("b:b").columnwidth = 50.44
    columns("b:b").columnwidth = 39.56
    columns("b:b").columnwidth = 39
    columns("a:a").columnwidth = 5.44
    columns("a:a").columnwidth = 5
    range("a17").select
    activecell.formular1c1 = "=counta(r[-2]c,r[-1]c)"
    end with
    end sub

    la quale funziona. il problema è che l'applicazione è molto macchinosa:
    1) click sulla macro e compare anteprima di stampa budget; 2) click su chiudi e riappare anteprima di stampa budget; 3) click su chiudi ed infine parte la macro come deve essere.
    non so come come eliminare i punti 1 e 2



  • di Fausto (utente non iscritto) data: 01/09/2010

    Il problema è sato risolto. lamacro é "figlia" di altre macro che hanno la caratteristica di aprirsi in anteprima di stampa. tolto quel comando tutto funziona.
    gradirei qualche aiuto, se possibile, per i miei post precedenti.
    grazie