⑴ 别人用excel表格做的管理系统怎么查看此管理系统的源码
新建excel文件,alt+F11进入VBA编辑器,插入模块,输入以下代码:
Sub MoveProtect()
Dim FileName As String
FileName = Application.GetOpenFilename("Excel文件(*.xls & *.xla),*.xls;*.xla", , "VBA破解")
If FileName = CStr(False) Then
Exit Sub
Else
VBAPassword FileName, False ' 引用下面的自定义函数
End If
End Sub
Private Function VBAPassword(FileName As String, Optional Protect As Boolean = False)
If Dir(FileName) = "" Then
Exit Function
Else
FileCopy FileName, FileName & ".bak"
End If
Dim GetData As String * 5
Open FileName For Binary As #1
Dim CMGs As Long
Dim DPBo As Long
For i = 1 To LOF(1)
Get #1, i, GetData
If GetData = "CMG=""" Then CMGs = i
If GetData = "[Host" Then DPBo = i - 2: Exit For
Next
If CMGs = 0 Then
MsgBox "请先对VBA编码设置一个保护密码...", 32, "提示"
Exit Function
End If
If Protect = False Then
Dim St As String * 2
Dim s20 As String * 1 '取得一个0D0A十六进制字串
Get #1, CMGs - 2, St '取得一个20十六制字串
Get #1, DPBo + 16, s20 '替换加密部份机码
For i = CMGs To DPBo Step 2
Put #1, i, St
Next '加入不配对符号
If (DPBo - CMGs) Mod 2 <> 0 Then
Put #1, DPBo + 1, s20
End If
MsgBox "文件解密成功......", 32, "提示"
Else
Dim MMs As String * 5
MMs = "DPB="""
Put #1, CMGs, MMs
MsgBox "对文件特殊加密成功......", 32, "提示"
End If
Close #1
End Function
2. 运行上面的代码,选择你的文件,移除密码成功后打开文件,按alt+F11查看源码:
⑵ 在EXCEL中如何编写程序
1、打开excel软件,点击左上角“文件”;
⑶ 求excel中sum函数源代码
问题有点复杂化!
其腔唯实,能理解函数语法即可。如:
SUM(number1,number2, ...)
其中,Number1, number2, ... 为 1 到 30 个需要求和的参数慎圆昌。
函数源代码是计算机编程语言。如:
假设函数:=SUM(A1:A100)
用VBA 编写的就是(在B1得出求和结果)宽扒:
Sub Macro()
Sheet1.[B1] = Application.Sum(Sheet1.[A1:A100])
End Sub
是不是要这样?
⑷ 求个 c# 读取excel 的 源码,可以运行的。
采用OleDB读取EXCEL文件:亮尺
把EXCEL文件当做一个数据源来进行数据的读取操作,实念前例如下:
public DataSet ExcelToDS(string Path)
{
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +"Data Source="+ Path +";"+"Extended Properties=Excel 8.0;";
OleDbConnection conn = new OleDbConnection(strConn);
conn.Open();
string strExcel = "";
OleDbDataAdapter myCommand = null;
DataSet ds = null;
strExcel="select * from [sheet1$]";
myCommand = new OleDbDataAdapter(strExcel, strConn);
ds = new DataSet();
myCommand.Fill(ds,"table1");
return ds;
}
对于EXCEL中的表即sheet([sheet1$])如果不是固定的可以使用下面的方法得到
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +"Data Source="+ Path +";"仔键清+"Extended Properties=Excel 8.0;";
OleDbConnection conn = new OleDbConnection(strConn);
DataTable schemaTable = objConn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables,null);
string tableName=schemaTable.Rows[0][2].ToString().Trim();
⑸ VB 操作EXCEL 源码
'工程-引用-Microsoft Excel Object library(勾选此项)
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
'写文件
Private Sub Command1_Click()
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add '新建EXCEL工件簿文件
Set xlSheet = xlBook.Worksheets(1)
For i = 1 To 10 '10行
For j = 1 To 10 '10列
xlSheet.Cells(i, j) = i * j
Next j
Next i
xlSheet.SaveAs "d:\test.xls" '按指定文件名存盘
xlApp.Quit '结束EXCEL对象
Set xlApp = Nothing '释放xlApp对象
End Sub
'读文件
Private Sub Command2_Click()
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Application.Workbooks.Open("d:\test.xls")
Set xlSheet = xlBook.Worksheets(1)
Dim s As String
For i = 1 To 10 '读取10行
For j = 1 To 10 '读取10列
s = s & xlSheet.Cells(i, j) & Space(5)
Next j
s = s & vbNewLine '另起一行
Next i
Print s
xlApp.Quit '结束EXCEL对象
Set xlApp = Nothing '释放xlApp对象
End Sub
两个命令按钮,先写文件,再读出来输出到窗体,最简单的读写操作。