还有我定义的时候 dim db as... 空格后没有databasee 或者 adodb 等数据库的连接串出来 是不是需要装什么控件啊? 我想用 oracle 数据库操作 该怎么定义呢?
Dim xlApp As Excel.Application Dim xlBook As Excel.Workbook Dim xlSheet As Excel.Worksheet Set xlApp = CreateObject("Excel.Application") xlApp.Workbooks.Open FileName:=Text1.Text sheetNum = xlApp.Worksheets.Count For i = 1 To sheetNum Set xlSheet = xlBook.Worksheets(i) next i 我依次打开工作薄中的每个工作表 这样提示没有SET 哪里出错了? 高手快指教急
Text1.Text是我设置的一个文本框 指定打开这个文本框的工作薄 确实是路径 如果把Set xlSheet = xlBook.Worksheets(i)这句注释后 xlApp.Worksheets.Count有值为3 我把Set xlSheet = xlBook.Worksheets(i)这句换成xlApp.Worksheets [i].Activate 提示“invalid use of property”
应该是 Set xlSheet = xlapp.Worksheets(i) 犯了个不可饶恕的小错误xlSheet.Cells(Irownum, icolnum).Formula 这句是从单元格提取公式或数值或字符串 大家帮我想想这段怎么全部是‘2’啊? 给分的啊 今天搞顶了全部给分 我所有的帖子全结了。 If IsNumeric(xlSheet.Cells(Irownum, icolnum).Formula) <> True Then sql_bstail = sql_bstail & " '1 '," ElseIf InStr(xlSheet.Cells(Irownum, icolnum).Formula, "=") = 1 Then '第一个字符为“=”时判断为公式 sql_bstail = sql_bstail & "'0 '," Else sql_bstail = sql_bstail & "'2'," End If
Private Function ShowOpen1() As Boolean On Error GoTo errhandle ShowOpen1 = False '预设返回值为false CommonDialog1.CancelError = True '按取消则跳至ErrHandle后返回false CommonDialog1.ShowOpen '打开选择对话框 ShowOpen1 = True '按下OK则返回true Exit Function errhandle: ShowOpen1 = False End Function Private Sub Command1_Click() CommonDialog1.Filter = "All Files(*.*)|*.*|(*.xls)|*.xls|(*.text)|*.txt|(*.doc)*.doc|" CommonDialog1.Action = 1 If True = ShowOpen1 Then Text1.Text = CommonDialog1.FileName End If End Sub 这段代码 使用commondialog控件 作用是通过command1 选择一个文件 显示在文本框 但是确定的时候要2次 是什么原因啊?
在excel里面,你应该去office区问最后说在.net里面调用excel,添加一个excel的COM,就能用了,具体怎么弄你搜索一下,很多的
不知道公式的名字可以这样,先开一个excel,记录宏,然后在excel里面自己用一下那个公式,然后看那个宏就知道了
是这样的 , 我想把excel中的数据在.net中 导出
同时能包括里面的公式,比如在sheet表中c1列 "=sum(a1,b1)" 这样的公式也能导出我收索了半天好象只能在vb中实现
这样就可以直接弹出了
还有个问题就是 用ACSSE 和ORACLE 操作excel的时候 区别在哪里?
有这方面代码吗?
是不是需要装什么控件啊? 我想用 oracle 数据库操作 该怎么定义呢?
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = CreateObject("Excel.Application")
xlApp.Workbooks.Open FileName:=Text1.Text
sheetNum = xlApp.Worksheets.Count
For i = 1 To sheetNum
Set xlSheet = xlBook.Worksheets(i)
next i
我依次打开工作薄中的每个工作表 这样提示没有SET 哪里出错了?
高手快指教急
然后把xlApp.Worksheets.Count的值打出来看看
如果把Set xlSheet = xlBook.Worksheets(i)这句注释后
xlApp.Worksheets.Count有值为3
我把Set xlSheet = xlBook.Worksheets(i)这句换成xlApp.Worksheets [i].Activate
提示“invalid use of property”
大家帮我想想这段怎么全部是‘2’啊? 给分的啊 今天搞顶了全部给分 我所有的帖子全结了。
If IsNumeric(xlSheet.Cells(Irownum, icolnum).Formula) <> True Then
sql_bstail = sql_bstail & " '1 ',"
ElseIf InStr(xlSheet.Cells(Irownum, icolnum).Formula, "=") = 1 Then '第一个字符为“=”时判断为公式
sql_bstail = sql_bstail & "'0 ',"
Else
sql_bstail = sql_bstail & "'2',"
End If
On Error GoTo errhandle
ShowOpen1 = False '预设返回值为false
CommonDialog1.CancelError = True '按取消则跳至ErrHandle后返回false
CommonDialog1.ShowOpen '打开选择对话框
ShowOpen1 = True '按下OK则返回true
Exit Function
errhandle:
ShowOpen1 = False
End Function
Private Sub Command1_Click()
CommonDialog1.Filter = "All Files(*.*)|*.*|(*.xls)|*.xls|(*.text)|*.txt|(*.doc)*.doc|"
CommonDialog1.Action = 1
If True = ShowOpen1 Then
Text1.Text = CommonDialog1.FileName
End If
End Sub
这段代码 使用commondialog控件 作用是通过command1 选择一个文件 显示在文本框
但是确定的时候要2次 是什么原因啊?