Opening a spreadsheet without warnings

K

Klatuu

Here is one I can't find any help on. I was using early binding to open a
workbook, but because of different versions of Access and Excel we have, I
have to change it to late binding. Using early binding, the following would
allow me to open the workbook without getting a warning message about
updating external data sources:
Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Open(varGetFileName, 0)

Since I now have to use the GetObject:
Set xlApp = GetObject(varGetFileName)

I can't find a way to supress the message.
Any assistance will be appreciated.
 
K

Ken Snell [MVP]

Try using this code for late binding:

Dim xlApp As Object, xlBook As Object
Set xlApp = GetObject(, "Excel.Application")
Set xlBook = xlApp.Workbooks.Open(varGetFileName, 0)
 
K

Klatuu

Thanks, Ken. It worked. I was trying that approach, but I did not do it
quite right. I appreciate the help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top