Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 5th, 2016, 07:53 AM
thila_a thila_a is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2016
Posts: 1 thila_a User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 24 sec
Reputation Power: 0
Question Protect and unprotect excel sheet via ms access

Hi I need help to protect an excel sheet via ms access.
I am trying to open an excel file and unprotect it then transfer data
From access table to excel then protect the excel sheet
Appreciate a reply .thanks

Reply With Quote
  #2  
Old May 26th, 2016, 05:07 PM
informer informer is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2016
Posts: 10 informer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 33 m 52 sec
Reputation Power: 0
Hi thila_a

The code

Code:
 Private Sub cmdExportXls_Click()

On Error GoTo Err_

    Dim sPath As String, sAddress As String
    
    sPath = CurrentProject.Path & "\" & "data2.xlsx"
    

     DoCmd.OutputTo acOutputTable, "Data2", acFormatXLSX, sPath, False
     
    '- Open Excel file
    Set appExcel = CreateObject("Excel.Application")
    Set bookExcel = appExcel.Workbooks.Open(sPath)
    Set sheetExcel = appExcel.ActiveWorkbook.Sheets("Data2")
    
    'To activate filter mode
    sheetExcel.Range("a1").CurrentRegion
    appExcel.Selection.AutoFilter
    
    'To freeze the first row
    sheetExcel.Rows("1:1").Select
    'sheetExcel.Rows(1).Select
    With appExcel.ActiveWindow
        .SplitColumn = 0
        .SplitRow = 1
        .FreezePanes = True
    End With
    
    sheetExcel.Unprotect
    bookExcel.Save
    
    MsgBox "Over"
    
Exit_:
       
    Set sheetExcel = Nothing
    Set bookExcel = Nothing
    appExcel.Quit
    Set appExcel = Nothing
    Exit Sub

Err_:
     MsgBox Err.Description
     Resume Exit_

End Sub

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Protect and unprotect excel sheet via ms access


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap