顯示具有 powerpoint VBA 標籤的文章。 顯示所有文章
顯示具有 powerpoint VBA 標籤的文章。 顯示所有文章

2009年2月3日 星期二

透過VBA 將Excel中所有的圖片與FaceID列出


最近因為研究vba內製作工具列,因此特別需要圖示(自己畫自訂圖想說麻煩之後再研究),所以就找了一下不然每次FaceID都亂填~~找了很久終於Google大神幫我找到了分享一下~
以下附上程式碼

Private Sub CommandButton1_Click()

Dim NewToolbar As CommandBar
Dim NewButton As CommandBarButton
Dim i As Integer, IDStart As Integer, IDStop As Integer


On Error Resume Next
Application.CommandBars("FaceIds").Delete
On Error GoTo 0


Set NewToolbar = Application.CommandBars.Add _
(Name:="FaceIds", temporary:=True)
NewToolbar.Visible = True


IDStart = 1
IDStop = 800

For i = IDStart To IDStop
Set NewButton = NewToolbar.Controls.Add _
(Type:=msoControlButton, ID:=2950)
NewButton.FaceId = i
NewButton.Caption = "FaceID = " & i
Next i
NewToolbar.Width = 600

End Sub


接著大家快點去玩工具列吧~

2009年1月28日 星期三

VBA上連線db教學範例

最近研究了一下office系列內的巨集,本來以為這種Basic語言是無法連資料庫的,沒想到真的有人有這個需求,所以我就研究一下vba連線到db抓資料,找了許多資料沒想到真的可以這樣連阿!!!
我的範例是連線 MS SQL2005,說真的感的滿久的才弄出來,現在跟大家分享一下嚕

首先小弟我打開PowerPoint中巨集選項的Visual Basic工具 我先拉個TextBox與Button,然後我要去做當我按下Button時候就連線到db取得我想要的資料,最後再把他print出來,既然可以連線到db剩下的運用就自己去想嚕