发布新日志

  • capturebitmap and save image in .xls cell

    2008-06-03 13:59:32

    Set ōExcel = CreateObject("Excel.Application")
    On Error Resume Next
    oExcel.WorkBooks.
    Open "C:\YourFile.xls"
    Set ōbjSheet = oExcel.ActiveWorkbook.Worksheets(1)
    objSheet.OLEObjects.Add(,
    "C:\YourImageFile.png",False,True, "mspaint.exe",0,"C:\YourImageFile.png").Select
    oExcel.ActiveWorkbook.Save : oExcel.ActiveWorkbook.
    Close
    oExcel.Application.Quit
    Set ōExcel = Nothing : Set ōbjSheet = Nothing

    Would this help any

    Sub InsertAndMovePicture(sPictureName As String, sCellAddress As String)

    With ActiveSheet.Pictures(sPictureName)
        .Left = ActiveSheet.Range(sCellAddress).Left
        .Top = ActiveSheet.Range(sCellAddress).Top
      End With
    End Sub
    Sub CallMovePicture()
    ActiveSheet.Pictures.Insert("C:\CRISNET\EXPORT\CMA_Picture_Group\CMA_Picture.jpg").Select
        Selection.Name = "Picture-1"
        Application.Run "InsertAndMovePicture", "Picture-1", "A1"
    End Sub

  • Retrieve Xls file data

    2008-06-03 13:58:47

    'Returns a two dimentional array with the excel data
    Function GetExcelData(sFileName, sSheetName)
       
    Dim oExcel 'The excel's COM object
       
    Dim arrRange 'The retrieved data
       
    On Error Resume Next
       
    Set ōExcel = CreateObject("Excel.Application")
       
    If err.Number <> 0 Then
         
    MsgBox "Can't Initiate excel." & vbCrLf & _
             
    "This operation requires MS excel to be installed.", vbCritical
         
    Exit Function
       
    End If
       
    On Error Goto 0
       
    On Error Resume Next
       oExcel.Workbooks.
    Open(sFileName)
       
    If err.Number <> 0 Then
         
    MsgBox "Can't load excel file." & vbCrLf & _
             
    "Make sure the file name is correct", vbCritical
         
    Exit Function
       
    End If
       
    On Error Goto 0
       
    'Open the sheet and extract the data
       
    Set ōSheet = oExcel.Worksheets(sSheetName).UsedRange
       
    Set ōRange = oSheet.Range("A1:Z1000")
       
    'Cast excel data into a two-dimentional array
       arrRange = oRange.
    Value
       oExcel.WorkBooks.Item(
    1).Close
       oExcel.Quit
       
    Set ōExcel = Nothing
       GetExcelData = arrRange
    End Function

  • How to capture all the links in a page

    2008-06-03 13:57:53

    Dim oDesc, oChildren
     
    Set ōDesc = Descrīption.Create
      oDesc(
    "micclass").Value = "Link"
      ōChildren = Browser(
    "A").Page("B").ChildObjects(oDesc)

我的栏目

数据统计

  • 访问量: 2092
  • 日志数: 3
  • 建立时间: 2008-04-25
  • 更新时间: 2008-06-03

RSS订阅

Open Toolbar