+ Reply to Thread
Results 1 to 3 of 3

Controling 1 Office program from aother

  1. #1
    Gene
    Guest

    Controling 1 Office program from aother

    I just want an email received date placed in an excel cell.
    Below are the things I have tried.

    Dim wbXL As Excel.Application

    Set wbXL = Excel.Application
    ‘the above line works and goes through

    Set wbXL = Excel.Application.Workbooks("G:\Print pdf files3.xls")
    ‘the above line does not work and returns Script out of range error

    Set wbXL = workbooks("G:\Print pdf files3.xls")
    ‘the above line does not work and returns Script out of range error

    For Each objMailItem In objPersonalInbox.Items

    MsgBox objMailItem.Subject & " " & objMailItem.ReceivedTime
    ‘the above line works and returns subject and received time

    wbXL.workbooks("G:\Print pdf files3.xls").sheets("Sheet1").[g2] = "PP"
    ‘the above line does not work and returns Script out of range error


    wbXL.workbooks("G:\Print pdf files3.xls").sheets("Sheet1").[g2] =
    objMailItem.ReceivedTime
    ‘the above line does not work and returns Script out of range error
    Next

    I don’t care if I need to use a variable to do this with and then
    dump the value in to excel
    But I can’t get that to work either.
    Can any one help?
    Any help would be appreciated.

    Thank You genelm



  2. #2
    Forum Contributor
    Join Date
    12-11-2004
    MS-Off Ver
    2007
    Posts
    137
    Hello Gene

    you may try


    ....
    wbXL.Sheets("Sheet1").[g2] = "PP"
    ‘the above line does not work and returns Script out of range error

    wbXL.Sheets("Sheet1").[g2] = objMailItem.ReceivedTime
    ....



    Regards ,
    michel

  3. #3
    Jim Cone
    Guest

    Re: Controling 1 Office program from aother

    'Try something like this...
    '--------------------------
    Dim xlApp As Excel.Application
    Dim WB As Excel.Workbook
    Dim WS As Excel.Worksheet

    Set xlApp = New Excel.Application
    Set WB = xlApp.Workbooks.Open("G:\Print pdf files3.xls")
    Set WS = WB.Sheets(1)

    WS.Range("G2").Value = "PP...."

    WB.Close savechanges:=True
    Set WS = Nothing
    Set WB = Nothing
    xlApp.Quit
    Set xlApp = Nothing
    '---------------------

    Jim Cone
    San Francisco, USA


    "Gene" <[email protected]> wrote in message
    news:[email protected]...
    I just want an email received date placed in an excel cell.
    Below are the things I have tried.

    Dim wbXL As Excel.Application

    Set wbXL = Excel.Application
    ‘the above line works and goes through

    Set wbXL = Excel.Application.Workbooks("G:\Print pdf files3.xls")
    ‘the above line does not work and returns Script out of range error
    Set wbXL = workbooks("G:\Print pdf files3.xls")
    ‘the above line does not work and returns Script out of range error
    For Each objMailItem In objPersonalInbox.Items
    MsgBox objMailItem.Subject & " " & objMailItem.ReceivedTime
    ‘the above line works and returns subject and received time
    wbXL.workbooks("G:\Print pdf files3.xls").sheets("Sheet1").[g2] = "PP"
    ‘the above line does not work and returns Script out of range error
    wbXL.workbooks("G:\Print pdf files3.xls").sheets("Sheet1").[g2] = bjMailItem.ReceivedTime
    ‘the above line does not work and returns Script out of range error
    Next

    I don’t care if I need to use a variable to do this with and then
    dump the value in to excel
    But I can’t get that to work either.
    Can any one help?
    Any help would be appreciated.
    Thank You genelm



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1