473,395 Members | 1,454 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Open, refresh and close Excel from Access

I'm trying to get access to open, refresh and then close an excel
spreadsheet for me. Below is the code I'm using to open and close Excel, I
just can't get it to refresh my data linked back to my database, the problem
appears to be that if I open Excel myself a window pops up and asks to
Enable or Disable Automatic Refresh. Any thoughts on how to get the
spreahseet to refresh?

Dim appexcel As Object
Set appexcel = CreateObject("Excel.Application")
appexcel.workbooks.Open "c:\outlookloader.xls"
appexcel.Visible = True

Aug 16 '07 #1
4 19692
Scott wrote:
I'm trying to get access to open, refresh and then close an excel
spreadsheet for me. Below is the code I'm using to open and close Excel, I
just can't get it to refresh my data linked back to my database, the problem
appears to be that if I open Excel myself a window pops up and asks to
Enable or Disable Automatic Refresh. Any thoughts on how to get the
spreahseet to refresh?

Dim appexcel As Object
Set appexcel = CreateObject("Excel.Application")
appexcel.workbooks.Open "c:\outlookloader.xls"
appexcel.Visible = True
I think the second arguement in the workbooks.open method, is
UpdateLinks. Try

appexcel.workbooks.Open "c:\outlookloader.xls", True

--
Roy-Vidar
Aug 17 '07 #2
Hi Roy,

That didn't do it, it still won't update the linked data, any more ideas?

Scott

"RoyVidar" <ro*************@yahoo.nowrote in message
news:46**********************@nn1-read.tele2.net...
Scott wrote:
>I'm trying to get access to open, refresh and then close an excel
spreadsheet for me. Below is the code I'm using to open and close Excel,
I
just can't get it to refresh my data linked back to my database, the
problem
appears to be that if I open Excel myself a window pops up and asks to
Enable or Disable Automatic Refresh. Any thoughts on how to get the
spreahseet to refresh?

Dim appexcel As Object
Set appexcel = CreateObject("Excel.Application")
appexcel.workbooks.Open "c:\outlookloader.xls"
appexcel.Visible = True

I think the second arguement in the workbooks.open method, is
UpdateLinks. Try

appexcel.workbooks.Open "c:\outlookloader.xls", True

--
Roy-Vidar

Aug 18 '07 #3
Scott wrote:
Hi Roy,

That didn't do it, it still won't update the linked data, any more ideas?

Scott

"RoyVidar" <ro*************@yahoo.nowrote in message
news:46**********************@nn1-read.tele2.net...
>Scott wrote:
>>I'm trying to get access to open, refresh and then close an excel
spreadsheet for me. Below is the code I'm using to open and close Excel,
I
just can't get it to refresh my data linked back to my database, the
problem
appears to be that if I open Excel myself a window pops up and asks to
Enable or Disable Automatic Refresh. Any thoughts on how to get the
spreahseet to refresh?

Dim appexcel As Object
Set appexcel = CreateObject("Excel.Application")
appexcel.workbooks.Open "c:\outlookloader.xls"
appexcel.Visible = True
I think the second arguement in the workbooks.open method, is
UpdateLinks. Try

appexcel.workbooks.Open "c:\outlookloader.xls", True

--
Roy-Vidar
I was so sure I'd used this recently, that I didn't even test...

The refreshlinks arguement takes 1, 2 or 3, where 3, as I now
understand, *should*, mean an automatic refresh when opening, but it
didn't when I finally tested.

What worked, was invoking the .RefreshAll method of the workbook, i e

appexcel.workbooks.Open "c:\outlookloader.xls"
appexcel.activeworkbook.refreshall

or, as I would probably do, have a separate workbook object

set wr = appexcel.workbooks.Open("c:\outlookloader.xls")
wr.refreshall
appexcel.visible = true
set wr = nothing
set appexcel = nothing

Hopefully this brings you a step further, and as I've been told by MS
Access upteen times, I'm sorry for the inconvenience...

--
Roy-Vidar
Aug 19 '07 #4
Hi Roy,

That appears to be the fix, thank you very much.

Scott

"RoyVidar" <ro*************@yahoo.nowrote in message
news:46**********************@nn1-read.tele2.net...
Scott wrote:
>Hi Roy,

That didn't do it, it still won't update the linked data, any more ideas?

Scott

"RoyVidar" <ro*************@yahoo.nowrote in message
news:46**********************@nn1-read.tele2.net...
>>Scott wrote:
I'm trying to get access to open, refresh and then close an excel
spreadsheet for me. Below is the code I'm using to open and close
Excel, I
just can't get it to refresh my data linked back to my database, the
problem
appears to be that if I open Excel myself a window pops up and asks to
Enable or Disable Automatic Refresh. Any thoughts on how to get the
spreahseet to refresh?

Dim appexcel As Object
Set appexcel = CreateObject("Excel.Application")
appexcel.workbooks.Open "c:\outlookloader.xls"
appexcel.Visible = True

I think the second arguement in the workbooks.open method, is
UpdateLinks. Try

appexcel.workbooks.Open "c:\outlookloader.xls", True

--
Roy-Vidar

I was so sure I'd used this recently, that I didn't even test...

The refreshlinks arguement takes 1, 2 or 3, where 3, as I now
understand, *should*, mean an automatic refresh when opening, but it
didn't when I finally tested.

What worked, was invoking the .RefreshAll method of the workbook, i e

appexcel.workbooks.Open "c:\outlookloader.xls"
appexcel.activeworkbook.refreshall

or, as I would probably do, have a separate workbook object

set wr = appexcel.workbooks.Open("c:\outlookloader.xls")
wr.refreshall
appexcel.visible = true
set wr = nothing
set appexcel = nothing

Hopefully this brings you a step further, and as I've been told by MS
Access upteen times, I'm sorry for the inconvenience...

--
Roy-Vidar

Aug 21 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: David Berman | last post by:
Hi, I've written an application to do a while bunch of Excel automation. I open a file, scan through all the worksheets, extract data, and then I try to close Excel. However, I can see that I'm...
8
by: SteveS | last post by:
I'm attempting to close EXCEL from within my VB.NET application. Using the excel object library to write data to my spreadsheet is working fine but when I try to quit application object it does not...
7
by: SteveS | last post by:
I'm attempting to close EXCEL from within my VB.NET application. Using the excel object library to write data to my spreadsheet is working fine but when I try to quit application object it does not...
6
by: icony | last post by:
Hi everyone, Here's my problem. I have a report that i want to use with the command openreport. The report open and close in a fraction of a second. I cant see why i cant view the thing. Cause i...
4
by: BFoxDDS | last post by:
i'm sure this is simple to do, but i can't find the answer in the search engines. i have an access db with 400,000 records. i produce queries of 5,000 records at a time exported into an excel...
1
by: Ultima | last post by:
I have searched the group and it seems this question has been asked and answered before, yet I still can't fix it after applying the answers I found. Basically, when I open an existing Excel...
0
by: Scott | last post by:
I'm trying to get access to open, refresh and then close an excel
1
by: popsoftheyear | last post by:
I'm trying to automate some very simple things in excel, but have run into a roadblock (using c++). To detect excel closing, I just monitor the Excel Process using WaitForSingleObject. In order to...
2
by: defabiisk | last post by:
Hello, I'm trying to open some data I've collected in my Perl DBI script - in excel. I'm using Javascript function to try and open the data in execl - without trying to do a SaveAs first. So I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.