Results 1 to 2 of 2

Thread: Using VBA to open an excel file (updating problem)

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    May 2005
    Posts
    32

    Resolved Using VBA to open an excel file (updating problem)

    VB Geniuses,

    Based on a suggestion from a previous thread, I have implemented the following lines of code to open an Excel file, extract the data from one of the cells, and close the file:

    VB Code:
    1. Sub FindMe()
    2.     Dim oApp As Object
    3.     Dim oWB As Object
    4.     Set oApp = CreateObject("Excel.Application")
    5.     oApp.Visible = True
    6.     Set oWB = oApp.Workbooks.Open("C:\filename.xls")
    7.     MsgBox oWB.Sheets(1).Cells(6, 15).Value
    8.     oWB.Close
    9.     Set oWB = Nothing
    10.     oApp.Quit
    11.     Set oApp = Nothing
    12. End Sub

    The problem is that this program does not work if the Excel file has links. In this case, Excel asks you if you want to update the links or not and nothing happens. I would like to be able to modify the code to detect if the file will be prompted to update, and to either update or not update the file. Then it should extract the info it needs and save and close the file.

    Thanks,

    VO
    Last edited by ovlia1286; Jun 7th, 2005 at 08:21 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width