Solved

Turn off update links using VBA

Posted on 2009-04-13
4
1,947 Views
Last Modified: 2013-11-27
Hi Experts,

I'm having trouble turning off the dialog box for user to choose update/edit the links in a Excel workbook using VBA. The codes are written in Access:

The prompt still appears although I set it as update always.
Can anyone help?
Thanks.
Dim acExcel, wb
     Dim xlPath
     xlPath = "F:\xxxxxx"
     Set acExcel = CreateObject("Excel.Application")
     acExcel.Visible = True
     Set wb = acExcel.Workbooks.Open(Filename:=xlPath, UpdateLinks:=xlUpdateLinksAlways)
     With wb.worksheets("Sheet1")
     '--------work on the data-------------
     End With
     wb.Close False
     Set wb = Nothing
     acExcel.Quit
     Set acExcel = Nothing

Open in new window

0
Comment
Question by:LizzJ
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 24135364
Hello LizzJ,

Try using the constant 3 instead of xlUpdateLinksAlways

Regards,
Chris
0
 
LVL 50

Accepted Solution

by:
Dave Brett earned 500 total points
ID: 24135372
You could turn off alerts as below
Cheers
Dave

xlPath = "c:\test2"
     Set acExcel = CreateObject("Excel.Application")
     acExcel.Visible = True
     acExcel.DisplayAlerts = False
     Set wb = acExcel.Workbooks.Open(Filename:=xlPath, UpdateLinks:=xlUpdateLinksAlways)
     With wb.Worksheets("Sheet1")
     '--------work on the data-------------
     End With
     wb.Close False
     Set wb = Nothing
        acExcel.DisplayAlerts = True
     acExcel.Quit
     Set acExcel = Nothing

Open in new window

0
 
LVL 50

Expert Comment

by:Dave Brett
ID: 24135384
Just checking  - I presume you want to update links, but kill the message box?
0
 

Author Comment

by:LizzJ
ID: 24135503
Thank you all. But Dave's solution works.
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question