Results 1 to 4 of 4

Thread: [RESOLVED] protect work sheet structure

  1. #1

    Thread Starter
    PowerPoster make me rain's Avatar
    Join Date
    Sep 2008
    Location
    india/Hubli
    Posts
    2,208

    Resolved [RESOLVED] protect work sheet structure

    with vb.net + excel 2002

    i am transferring data in to an new excel instance

    (1) how can i stop users form copy the contents of the work sheet
    answer is alm0st uncertain
    hence i want to protect the structure of my work sheet (book)

    if i protect the work sheet tools -> security ->xx...
    then the locked cells are not getting selected for copy purpose, where as how to do the same with vb.net .
    i mean an equivalent of VBA

  2. #2
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: protect work sheet structure

    Record a macro in Excel and amend it for vb.net....
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  3. #3

    Thread Starter
    PowerPoster make me rain's Avatar
    Join Date
    Sep 2008
    Location
    india/Hubli
    Posts
    2,208

    Wink Re: protect work sheet structure

    ia very cool

    xlSheet.EnableSelection = -4142
    thank you

  4. #4

    Thread Starter
    PowerPoster make me rain's Avatar
    Join Date
    Sep 2008
    Location
    india/Hubli
    Posts
    2,208

    Question Re: [RESOLVED] protect work sheet structure

    cool sid
    i am having one more issue please
    i want to apply the "Enableselection property of worksheet "
    to be applied for only the locked cells
    not to the columns, i must be able to enable column sizing + row sizing
    is it possible

    i tried this way but failed !

    Code:
     
    eXlWs.Cells.Locked = False
     eXlWs.Range("A5:m10").Cells.Locked = True
       
     eXlWs.Columns.AutoFit()
            eXlWs.Protect("123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 1, 1, 1, 1, 1, 1, 1)
    
    eXlWs.EnableSelection = _ Excel.XlEnableSelection.xlNoSelection
            ExlWb.Protect("123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")
    
            ExlAPp.CutCopyMode = False
            ExlAPp.Visible = True
            ExlAPp = Nothing
            ExlWb = Nothing
            eXlWs = Nothing
    '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    sorry cool sid
    i got the solution for my problem
    Last edited by make me rain; Mar 19th, 2010 at 02:29 AM. Reason: found solution

Posting Permissions

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



Click Here to Expand Forum to Full Width