|
-
May 27th, 2005, 01:11 PM
#1
Thread Starter
Member
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:
Sub FindMe()
Dim oApp As Object
Dim oWB As Object
Set oApp = CreateObject("Excel.Application")
oApp.Visible = True
Set oWB = oApp.Workbooks.Open("C:\filename.xls")
MsgBox oWB.Sheets(1).Cells(6, 15).Value
oWB.Close
Set oWB = Nothing
oApp.Quit
Set oApp = Nothing
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|