Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Web query on Open

I have a spreadsheet that I use to update information from the web ( although
I guess by reading the subject you already knew that ).
I found this vbscript code to open the file and I can set it to run on a
schedule but when the file opens the web query doens't refresh, even though I
have refresh on open checked.
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Open("C:\research\web52.xls")

I tried checking the "refresh every" and set it for 1 minute but I am still
asked if I want to enable automatic refresh.
1. how can I have it refresh on open automatically?
2.once the refresh has occured is it possible to, programatically save the
file and close it?

thanks in advance,
RogueIT
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Web query on Open

Try adding

objWorkbook.Sheets("sheetname here").QueryTables(1).Refresh
objWorkbook.save
objworkbook.close


--
Tim Williams
Palo Alto, CA


"RogueIT" wrote in message
...
I have a spreadsheet that I use to update information from the web (

although
I guess by reading the subject you already knew that ).
I found this vbscript code to open the file and I can set it to run on a
schedule but when the file opens the web query doens't refresh, even

though I
have refresh on open checked.
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Open("C:\research\web52.xls")

I tried checking the "refresh every" and set it for 1 minute but I am

still
asked if I want to enable automatic refresh.
1. how can I have it refresh on open automatically?
2.once the refresh has occured is it possible to, programatically save the
file and close it?

thanks in advance,
RogueIT



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Web query on Open

Hi RogueIT,

My suggestion fails because I included the : (colon) character, which is not
allowed in file names.

However, your code ran without problem for me.

---
Regards,
Norman



"RogueIT" wrote in message
...
I am still getting a VBScript runtime error
type mismatch: 'format'
on that line at the first char, even after the change...;-(

thanks,
RogueIT

"Norman Jones" wrote:

Hi RogueIT,

fname=Format(now,"MMDDYYYY_hhmmss")


Try:

fname = Format(Now, "mm-dd-yyyy hh:mm")


---
Regards,
Norman



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open a Query Sergio Mund New Users to Excel 0 January 2nd 08 03:06 PM
why does edit query button not open query needlemaker Excel Discussion (Misc queries) 0 June 29th 06 03:18 PM
Web query - Unable to open B. Wingbermuehle Excel Discussion (Misc queries) 0 May 26th 06 10:04 PM
open a query automatically BryanJ Excel Worksheet Functions 2 May 17th 06 12:12 AM
Edit Query from Excel will not open query in MSQuery Michelle Excel Programming 0 February 21st 05 03:59 PM


All times are GMT +1. The time now is 02:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"