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

2016年6月10日 星期五

[VBA] A macro for copying the text from pdf to excel with Adobe Reader ONLY

Sub pdf2exl()
    Dim starDir As String, PDFPath As String, READERPath As String

    'Starting path for user selecting pdf files
    startDir = "C:\testing\"
    ChDir startDir
    PDFPath = Application.GetOpenFilename(filefilter:="PDF file (*.pdf), *.pdf")
    If UCase(PDFPath) = "FALSE" Then
        Exit Sub
    End If

    'Please change to your own Adobe Reader installation path
    READERPath = "C:\Program Files (x86)\Adobe\Acrobat Reader\AcroRd32.exe "
    Shell READERPath & PDFPath, vbNormalFocus: DoEvents
    Application.Wait Now + TimeValue("00:00:2")
    SendKeys "^a", True
    Application.Wait Now + TimeValue("00:00:2")
    SendKeys "^c"
    Application.Wait Now + TimeValue("00:00:2")
    SendKeys "%{F4}", True
    Application.Wait Now + TimeValue("00:00:2")
    
    'Paste in Sheet1
    Worksheets("Sheet1").Activate
    Sheet1.Cells.Clear
    Sheet1.Paste Sheet1.Range("A1")
End Sub

2016年5月19日 星期四

[VBA] Outlook Auto Email when file is modified

是咁的,小弟要幫公司寫一個program, 當一個folder裡面任意一個file被改動時,就自動send email attach埋個file俾大家。最簡單當然係用現有嘅野,所以選用了VBA + Window API timer. (其實我未寫過VBA...XD)