private sub btn查詢_click()
dim conn as new adodb.connection
dim strconn as string
strconn = "provider=oraoledb.oracle.1; user id="
strconn = strconn & txt使用者名稱.value
strconn = strconn & "; password=" & txt密碼.value
strconn = strconn & ";data source = " & txt資料庫.value
strconn = strconn & "; persist security info=true"
conn.open strconn
call 查詢.資料化分析(conn)
conn.close '關資料庫
msgbox ("查詢完成!!")
end sub
private sub btn退出_click()
unload me
end sub
private sub txt資料庫_change()
end sub
sub add_menu()
dim wsmenubar as commandbar
dim helpmenu as commandbarcontrol
dim newmenu as commandbarpopup
dim menuitem as commandbarcontrol
dim submenuitem as commandbarbutton
set wsmenubar = commandbars("worksheet menu bar")
on error resume next
wsmenubar.controls("@資料化分析(&d)").delete
set helpmenu = wsmenubar.findcontrol(id:=30010)
if helpmenu is nothing then
set newmenu = wsmenubar.controls.add(type:=msocontrolpopup)
else
set newmenu = wsmenubar.controls.add(type:=msocontrolpopup, before:=helpmenu.index)
end if
newmenu.caption = "@資料化分析(&d)"
set menuitem = newmenu.controls.add(type:=msocontrolbutton)
with menuitem
.caption = "連線oracle資料庫(&a)"
.onaction = "顯示窗體"
.begingroup = true
end with
end sub
sub reset_menubar()
on error resume next
commandbars(1).controls("@資料化分析(&d)").delete
end sub
private sub 顯示窗體()
資料化分析.show
end sub
public sub 資料化分析(conn as adodb.connection)
dim rs as new adodb.recordset
dim strsql as string
dim 資料化分析sql as string
dim i, row as integer
dim ws as worksheet
dim rg as range
dim wb as workbook
dim fileopen as boolean
row = 1
set ws = worksheets("資料化分析")
set rg = ws.cells(65536, 1)
strsql = ""
for i = 1 to rg.end(xlup).row
strsql = strsql & " " & ws.cells(i, 1)
'ws.cells(row, i) = rs.fields(i - 1).name
next
rs.open strsql, conn
set ws2 = worksheets("查詢結果")
ws2.select
for i = 1 to rs.fields.count
ws2.cells(row, i) = rs.fields(i - 1).name
next
do until rs.eof
row = row + 1
for i = 1 to rs.fields.count
'ws2.cells(1, i) = rs.fields(i - row).name
ws2.cells(row, i) = rs.fields(i - 1).value
next
rs.movenext
loop
rs.close
end sub
從巨集開始學習VBA
從巨集開始學習vba 主講 三戒 助教 apirl2008 swabe 一 什麼是巨集?引伸到excel 中,當你開啟巨集的錄製功能時,巨集錄製器會想錄影機一樣將你在 excel 中的大多數操作進行錄製,並且可以這些錄製內容 即 進行回放和編輯。二 例項演示巨集錄製,執行 回放 的過程 錄製巨集 要...
VBA 從開始到放棄
debug de到腦殼疼,編 的好難呀!給自己定乙個30天的學習計畫,每天把熟練的 以及弄不懂的問題記錄在這裡,每天進步一點點!電腦上執行vba實在太費勁了!不玩了!1 累加器 計數器 1 course score 2 accouting 90 3 audit 98 4 it audit 95 di...
python 從陣列隨機取資料
在神經網路中,經常會用到批量樣本訓練。我們需要從陣列隨機取資料,主要有以下幾種方法 1 np.random.shuffle 將原陣列打亂 import numpy as np array np.random.randint 1,100,size 10 63 32 80 33 61 45 28 55 ...