Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Writing to an excel file
Message
From
12/05/2011 12:21:56
 
 
To
11/05/2011 12:46:27
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01510189
Message ID:
01510483
Views:
48
Yossi:

Password protection is pretty easy to do when you save the worksheet. I haven't tried unprotecting a sheet but suppose it could be done.

Scott
#INCLUDE ..\Excel.h
goExcel = CREATEOBJECT( "Excel.Application" )
goExcel.Visible = .T.
WITH goExcel
    .SheetsInNewWorkbook             = 1
    .Workbooks.Add 
    .ActiveSheet.Name                = "MySheet"
    .ActiveWindow.DisplayGridlines   = "TRUE"
    .ActiveWindow.DisplayHeadings    = "TRUE"
    .Application.DisplayFormulaBar   = "TRUE"
    .ActiveSheet.EnableCalculation   = "TRUE"
    .Cells.Font.Name                 = "Arial"
    .Cells.Font.Size                 = 10
    .Columns("A:A").NumberFormat     = "@"
    .Cells( 1, 1 ).Value             = "Going to password protect this sheet."
    .Cells( 2, 1 ).Value             = "The password, for what it's worth is Pa$$w0rd"
    *                        File Name       Format     Password
    .ActiveWorkbook.Saveas( "testPassword", xlExcel7, "Pa$$w0rd"  )
ENDWITH
RELEASE goExcel    
Scott Ramey
BDS Software
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform