Public Class Form1 Dim excelObj As Object Dim excelbook As Object 'Dim excelsheet As Object Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnConnect.Click Dim fileName As String = tBoxInputFileName.Text If Not My.Computer.FileSystem.FileExists(fileName) Then MsgBox(fileName & " does not exist") Exit Sub End If ' Set the object variable to refer to the file you want to use. excelObj = GetObject(fileName).Application excelObj.Application.Visible = True Dim winCount As Integer = excelObj.Parent.Windows.Count() excelObj.Parent.Windows(winCount).Visible = True excelbook = excelObj.Workbooks(1) 'excelsheet = excelbook.Sheets("Mydata") 'Region save 기능 구현시 Sheet Name 을 참조하게 한다 End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles btnStart.Click Timer1.Interval = Convert.ToInt32(tBoxInterval.Text) * 1000 Timer1.Start() End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick If rbtnWholeSave.Checked = True Then excelbook.SaveAs(tBoxOutFileName.Text + Format(Now, "hh_mm_ss") + ".xlsx") Else MsgBox("Not Implemented Yet") ' Region 잡아 특정 형식으로 Save 하는 코드 추가 End If End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles btnStop.Click Timer1.Stop() End Sub Private Sub Form1_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed excelObj = Nothing excelbook = Nothing 'excelsheet = Nothing End Sub End Class
'취미 > Soft' 카테고리의 다른 글
code highlighter 테스트 (0) | 2018.08.03 |
---|---|
[엑셀,VB] 엑셀 초단위 세이브하는 프로그램 수정판 (0) | 2015.08.25 |
[Snagit] 스케쥴드 캡쳐 기능, DDE 엑셀 캡쳐 (0) | 2015.08.20 |
[델파이, CP] Dgrabber for CP (0) | 2015.08.19 |
[델파이, CP] Type Library Import (0) | 2015.08.19 |
댓글