To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
MSDN Subscribers: Download the VS 2010 Release Candidate
MSDN Subscribers: Download the VS 2010 Release Candidate
Sell Your Code and Make Money?
Creating your own Tetris game using VB.NET
Article :: Improving Software Economics, Part 4 of 7: Top 10 Principles of Iterative Software Management



Go Back   VBForums > Visual Basic > Office Development

Reply Post New Thread
 
Thread Tools Search this Thread Display Modes
Old Feb 20th, 2007, 12:47 PM   #1
doasidont
Addicted Member
 
Join Date: Apr 02
Posts: 246
doasidont is an unknown quantity at this point (<10)
Need help with Excel web query

I've used a procedure to pull stock price historical data from Yahoo. Yahoo has changed something and now the procedure will not work. With a worksheet named 'Web Data' I execute the following. On occasion, data does get to the worksheet, but most of the time (and I cannot figure out why) I get an error stating that "The file could not be accessed ...", and then "Invalid Web Query". Here is the code that I am using:

'e.g. pull Dow Jones data for Feb 14 thru Feb 15.
smo = 2 ' Feb
sda = 14 ' 14
syr = 7 ' 2007
emo = 2 ' Feb
eda = 15 ' 15
eyr = 7 ' 2007
fund = "^DJI"
Sheets("Web Data").Activate
Range("a1").Select
Selection.Clear
With Selection.QueryTable
.Connection = _
"URL;http://finance.yahoo.com/q/hp?&a=" & smo - 1 & "&b=" & sda & "&c=" & syr _
& "&d=" & emo - 1 & "&e=" & eda & "&f=" & eyr & "&g=d&s=" & fund
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh
End With

The url for this, which works under Internet Explorer, is:
http://finance.yahoo.com/q/hp?&a=1&b=14&c=7&d=1&e=15&f=7&g=d&s=^DJI

I think the '?' is causing the problem but don't understand why it is intermittent or how I can get around it.

Any help will be much appreciated. Thanks.
doasidont is offline   Reply With Quote
Old Feb 20th, 2007, 12:49 PM   #2
RobDog888
Super Moderator
 
RobDog888's Avatar
 
Join Date: Apr 01
Location: LA, Calif. Raiders #1 AKA:Gangsta Yoda™
Posts: 58,668
RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)
Re: Need help with Excel web query

Moved
__________________
VB/Office Guru™ (AKA: Gangsta Yoda®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.

Microsoft MVP 2006, 2007, 2008, 2009, 2010
Office Development FAQ (VBA, VB 6, VB.NET, C#)
Software Engineer MCP (VB 6 & .NET), BSEE, CET (Internet.com's #1 Poster)
If a post has helped you then Please Rate it!
Star Wars Gangsta Rap Reps & Rating PostsVS.NET on Vista (New)Multiple .NET Framework Versions (New)Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 150 GB HDs RAID 1, 2 GBs DDR2 667 MHz RAM, 3 Viewsonic 17" LCDs, Windows Vista RTM, IE 7, Office 2007
RobDog888 is online now   Reply With Quote
Old Feb 20th, 2007, 12:59 PM   #3
Al42
PowerPoster
 
Join Date: Feb 06
Location: East of NYC, USA
Posts: 5,692
Al42 is a jewel in the rough (300+)Al42 is a jewel in the rough (300+)Al42 is a jewel in the rough (300+)Al42 is a jewel in the rough (300+)
Re: Need help with Excel web query

The '?" is the break between the URL and the arguments to the CGI that runs from that URL. The request won't work without it.

Debug the program and see if the URL actually gets set to http://finance.yahoo.com/q/hp?&a=1&b=14&c=7&d=1&e=15&f=7&g=d&s=^DJI every time. It should, unless one of the numeric variables is being treated as a string, in which case you're getting something like "a=2 - 1" instead of "a=1".
__________________
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.

Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

Please Help Us To Save Ana
Al42 is offline   Reply With Quote
Old Feb 20th, 2007, 01:21 PM   #4
doasidont
Addicted Member
 
Join Date: Apr 02
Posts: 246
doasidont is an unknown quantity at this point (<10)
Re: Need help with Excel web query

Thank you for trying to help. I've copied and pasted the actual url into the url argument but still get an error like the following:

"The file could not be accessed. Try one of the following:
- make sure the specified folder exists
- make sure the folder is not read-only
- make sure the file name does not contain ... < > ? [ ] " etc.

This is followed by "Invalid Web Query"

I'm sure you're right about the '?' because when I remove it, Yahoo reports back that the item can't be found (different from the Invalid Web Query error). So looks like I have to be able to pass the '?' but something is throwing up on it and not letting it pass thru to Yahoo. Any suggestions? Thanks.
doasidont is offline   Reply With Quote
Old Feb 20th, 2007, 02:11 PM   #5
doasidont
Addicted Member
 
Join Date: Apr 02
Posts: 246
doasidont is an unknown quantity at this point (<10)
Re: Need help with Excel web query

Another variation. When I try to Import External Data from the Data menu directly onto the Excel 2003 worksheet, passing the same url, and hitting the 'Import' button, I get the same error from Excel (File cannot be accessed. Invalid web query.)
doasidont is offline   Reply With Quote
Old Feb 20th, 2007, 02:26 PM   #6
Al42
PowerPoster
 
Join Date: Feb 06
Location: East of NYC, USA
Posts: 5,692
Al42 is a jewel in the rough (300+)Al42 is a jewel in the rough (300+)Al42 is a jewel in the rough (300+)Al42 is a jewel in the rough (300+)
Re: Need help with Excel web query

Maybe Excel just can't handle a CGI query. In that case, get the data using something other than Excel (like VB) and send the data itself to Excel.
__________________
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.

Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

Please Help Us To Save Ana
Al42 is offline   Reply With Quote
Old Feb 20th, 2007, 02:38 PM   #7
doasidont
Addicted Member
 
Join Date: Apr 02
Posts: 246
doasidont is an unknown quantity at this point (<10)
Re: Need help with Excel web query

You lost me. I tried to use a VBA procedure (documented above). Is VB something different and could you give me a little start as to how I would do it? Thanks.
doasidont is offline   Reply With Quote
Old Feb 20th, 2007, 03:28 PM   #8
doasidont
Addicted Member
 
Join Date: Apr 02
Posts: 246
doasidont is an unknown quantity at this point (<10)
Re: Need help with Excel web query

More info. Before Yahoo changed its web location, I used a similar url, which contained a '?', without problems.
doasidont is offline   Reply With Quote
Old Feb 20th, 2007, 03:52 PM   #9
Al42
PowerPoster
 
Join Date: Feb 06
Location: East of NYC, USA
Posts: 5,692
Al42 is a jewel in the rough (300+)Al42 is a jewel in the rough (300+)Al42 is a jewel in the rough (300+)Al42 is a jewel in the rough (300+)
Re: Need help with Excel web query

When I hit the Download To Spreadsheet button on the page, it imports with no problem. Maybe you need an &ignore=.csv on the end?
__________________
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.

Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

Please Help Us To Save Ana
Al42 is offline   Reply With Quote
Old Feb 20th, 2007, 04:03 PM   #10
doasidont
Addicted Member
 
Join Date: Apr 02
Posts: 246
doasidont is an unknown quantity at this point (<10)
Re: Need help with Excel web query

I can also download to the spreadsheet using the button you mentioned, but I cannot use that technique. My VBA procedure runs through a loop which retrieves data for a set of fund names and date ranges. After each fund's data is retrieved, I process it to other spreadsheets and go to the next fund. With a click of a button I get all the data for all the funds. It would be too cumbersome to do one fund at a time, downloading data each time.
doasidont is offline   Reply With Quote
Old Feb 20th, 2007, 04:06 PM   #11
doasidont
Addicted Member
 
Join Date: Apr 02
Posts: 246
doasidont is an unknown quantity at this point (<10)
Re: Need help with Excel web query

Holy sh$$, I think you fixed it for me. Adding the &ignore=.csv seems to have fixed the problem. What does that do? Thanks a bunch.
doasidont is offline   Reply With Quote
Old Feb 20th, 2007, 05:18 PM   #12
doasidont
Addicted Member
 
Join Date: Apr 02
Posts: 246
doasidont is an unknown quantity at this point (<10)
Re: Need help with Excel web query

Strange. It worked for several interations of retrieving prices for different funds and then stopped working for the same error reason.
doasidont is offline   Reply With Quote
Old Feb 20th, 2007, 05:21 PM   #13
RobDog888
Super Moderator
 
RobDog888's Avatar
 
Join Date: Apr 01
Location: LA, Calif. Raiders #1 AKA:Gangsta Yoda™
Posts: 58,668
RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)
Re: Need help with Excel web query

Where are you querying the stock quotes from? Perhaps could it be possible that querying it too often caused you to get locked out for some duration since it seemed to work several times?
__________________
VB/Office Guru™ (AKA: Gangsta Yoda®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.

Microsoft MVP 2006, 2007, 2008, 2009, 2010
Office Development FAQ (VBA, VB 6, VB.NET, C#)
Software Engineer MCP (VB 6 & .NET), BSEE, CET (Internet.com's #1 Poster)
If a post has helped you then Please Rate it!
Star Wars Gangsta Rap Reps & Rating PostsVS.NET on Vista (New)Multiple .NET Framework Versions (New)Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 150 GB HDs RAID 1, 2 GBs DDR2 667 MHz RAM, 3 Viewsonic 17" LCDs, Windows Vista RTM, IE 7, Office 2007
RobDog888 is online now   Reply With Quote
Old Feb 20th, 2007, 05:39 PM   #14
doasidont
Addicted Member
 
Join Date: Apr 02
Posts: 246
doasidont is an unknown quantity at this point (<10)
Re: Need help with Excel web query

From http://finance.yahoo.com/q/hp?.

It does look like some kind of timing thing because if I restart (I have restart logic in the procedure) after the error, it sometimes does go through another iteration. Once it went through 20 funds, another time about 10, and another time would not do any at all, even after restart.
doasidont is offline   Reply With Quote
Old Feb 20th, 2007, 05:53 PM   #15
RobDog888
Super Moderator
 
RobDog888's Avatar
 
Join Date: Apr 01
Location: LA, Calif. Raiders #1 AKA:Gangsta Yoda™
Posts: 58,668
RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)RobDog888 has a brilliant future (2000+)
Re: Need help with Excel web query

With stock quotes, you will have a 15 or 20 minute delay from real time quotes unless you are accessing a member login location where you are signed up to receive real time quotes.

You shouldnt be querying more then every 5 minutes or so I would think since its going to remain the same values for 15-20 minutes.

Or are you meaning you are having timing issues obtaining each indvidual stock?
__________________
VB/Office Guru™ (AKA: Gangsta Yoda®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.

Microsoft MVP 2006, 2007, 2008, 2009, 2010
Office Development FAQ (VBA, VB 6, VB.NET, C#)
Software Engineer MCP (VB 6 & .NET), BSEE, CET (Internet.com's #1 Poster)
If a post has helped you then Please Rate it!
Star Wars Gangsta Rap Reps & Rating PostsVS.NET on Vista (New)Multiple .NET Framework Versions (New)Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 150 GB HDs RAID 1, 2 GBs DDR2 667 MHz RAM, 3 Viewsonic 17" LCDs, Windows Vista RTM, IE 7, Office 2007
RobDog888 is online now   Reply With Quote
Old Feb 20th, 2007, 06:18 PM   #16
doasidont
Addicted Member
 
Join Date: Apr 02
Posts: 246
doasidont is an unknown quantity at this point (<10)
Re: Need help with Excel web query

No, I understand about the 20 min delay. I am actually getting historical quotes for a number of different stocks. It seems like something in the workbook is not getting cleared out. I tried to out in a 10 second delay between queries but that did not work either.
doasidont is offline   Reply With Quote
Old Feb 21st, 2007, 01:00 AM   #17
littlepd
Junior Member
 
littlepd's Avatar
 
Join Date: Jun 06
Location: Lewisville, TX
Posts: 28
littlepd is on a distinguished road (10+)
Re: Need help with Excel web query

In a URL, the ampersand (&) symbol is used as a separator between parameters passed to the called page. In your example, you have the question mark followed immediately by an ampersand. This means you are passing nothing as the first parameter. Granted, since all the parameters are named, this shouldn't be a problem.

It just looks funny.
__________________
I used to have a handle on life, but it broke.
littlepd is offline   Reply With Quote
Old Feb 21st, 2007, 12:04 PM   #18
doasidont
Addicted Member
 
Join Date: Apr 02
Posts: 246
doasidont is an unknown quantity at this point (<10)
Re: Need help with Excel web query

I noticed that and corrected it. Here is the url I am passing:
http://finance.yahoo.com/q/hp?s=^DJI&a=1&b=14&c=07&d=1&e=20&f=07&g=d&ignore=.csv

If I paste this url into the address box on the Data/Import External Data/Edit Query box and try to 'Import' onto a new blank worksheet, I get the 'File could not be accessed' error followed by 'Invalid Web Query'.

The url gets out to Yahoo and retrieves the data. Excel just won't import it because of some file access problem (error 1004).

Are there any other http parameters that will correct this?
doasidont is offline   Reply With Quote
Old Feb 21st, 2007, 12:29 PM   #19
doasidont
Addicted Member
 
Join Date: Apr 02
Posts: 246
doasidont is an unknown quantity at this point (<10)
Re: Need help with Excel web query

More info. If I change the '^' character in the url to '%5E', I can manually import the data onto the worksheet using the Data/Import External Data/Edit Query. So it's the '^' that seems to be causing a problem. That's in fact what the Yahoo server does when it returns the data. You can see this in the address box. Problem is even if I change the '^' to '%5E' in the url, my VBA procedure is still not working.
doasidont is offline   Reply With Quote
Old Feb 21st, 2007, 01:07 PM   #20
doasidont
Addicted Member
 
Join Date: Apr 02
Posts: 246
doasidont is an unknown quantity at this point (<10)
Re: Need help with Excel web query

Sorry, but I was not correct about the '%5E' replacement. I am totally lost on this at this time. Nothing seems to be working and when it does, it's inconsistent. If someone could suggest how I can debug this, I'd appreciate it. Thanks. Or if someone can tell me what file Excel thinks is wrong and how I can correct that, it would help me a lot.
doasidont is offline   Reply With Quote
Old Feb 22nd, 2007, 10:03 AM   #21
doasidont
Addicted Member
 
Join Date: Apr 02
Posts: 246
doasidont is an unknown quantity at this point (<10)
Re: Need help with Excel web query

This is looking like a problem with the Yahoo site itself because my original code started to work. It blazed through 30+ funds, then it started to slow down, and then it just stopped. I put in some error handling code to force a resume and if I wait long enough, the data is eventually downloaded and copied to the spreadsheet. But it looks like this has something to do with the Yahoo site and in particular this particular url dealing with historical stock prices. I've sent a message to Yahoo customer support.
doasidont is offline   Reply With Quote
Old Feb 28th, 2007, 06:44 AM   #22
Investor
New Member
 
Join Date: Feb 07
Posts: 1
Investor is an unknown quantity at this point (<10)
Re: Need help with Excel web query

Hello,

Is this still a problem for you?

Because I am having this problem on my home PC with excel 2003.

This problem started happening very recently and after trying everything possible... in my head.....I just googled my problem and stumbled upon your post. Noticed the date and time stamps on your posts and am convinved that something on yahoo side is causing the problem.

However, I tried taking this program to work and ran on a computer with down level of excel version and seems to be working fine.

my connection string looks like below

.Connection = "URL;http://finance.yahoo.com/q/hp?s=" & stocksymbol

if you have a solution please please pelase help!!!!!!!!
Investor is offline   Reply With Quote
Old Feb 28th, 2007, 09:40 AM   #23
doasidont
Addicted Member
 
Join Date: Apr 02
Posts: 246
doasidont is an unknown quantity at this point (<10)
Re: Need help with Excel web query

I never got a resolution to this problem. My url was trying to retrieve historical stock prices. Sometimes it worked fine, sometimes it was slow, and sometimes it never worked. I have since used the url with Yahoo uses to download the data. You can see it when you right click on the 'Download to Spreadsheet' button on the Yahoo site. It gives me what I need and it works great all the time. Yahoo did response to my inquiry asking for more information but I have not yet replied.
doasidont is offline   Reply With Quote
Old Feb 28th, 2007, 11:06 AM   #24
Monsterboy
New Member
 
Join Date: Feb 07
Posts: 1
Monsterboy is an unknown quantity at this point (<10)
Re: Need help with Excel web query

Same problem here, though I can provide no help. I'm trying to query company profiles from http://finance.yahoo.com/q?s= in Excel 2000 (using "http://finance.yahoo.com/q?s=" & Ticker & "&x=0&y=0" -- have also tried leaving off the "&x=0&y=0"). I get the same message. The urls open fine in my browser, of course.

Last night I went through 100 or so before it got stuck. Today I've I manged to get IBM 's profile to load as a test, but that's about it.
Monsterboy is offline   Reply With Quote
Old Mar 11th, 2007, 12:42 PM   #25
aclvsh
New Member
 
Join Date: Mar 07
Posts: 4
aclvsh is an unknown quantity at this point (<10)
Re: Need help with Excel web query

same problem here too, i m pulling closing price from urls like http://finance.yahoo.com/q?s=ibm, but got the "The file could not be accessed ..." message. the error happened after 30 queries (more of less).
and i m using excel 2003 on windows XP.

what is interesting is that it happened to my laptop after i install a few updates. but apparently my desktop works fine (i was lucky i try the updates on my laptop first). so i m guessing it has something to do with the updates may have disabled something. and it seems that the problem is very specific to yahoo finance.


updates that i installed that day:
for windows: KB927779, KB927802, KB928255, KB923723, KB924667, KB931836, KB926436, KB928090, KB918118, KB928843

for office: KB894542, KB924885, KB919029, KB924085, Service Pack2, KB920813, KB924424, KB920103, KB924085, KB929060, KB929057, KB925251, KB
929064, KB907417, KB929058 (Excel), KB914455, KB923097
aclvsh is offline   Reply With Quote
Old May 16th, 2007, 07:30 PM   #26
retsom
New Member
 
Join Date: May 07
Posts: 6
retsom is an unknown quantity at this point (<10)
Re: Need help with Excel web query

This happens to me occasionally. I shut all open Excel and Internet Explorer windows. Open a new IE window, COMPLETELY clear out the caches (tools/Internet Options/General/Browsing history--Delete... then Delete all from the Delete Browsing History). This will probably delete more than necessary (deleting passwords could probably be saved) but it seems to do the trick.
retsom is offline   Reply With Quote
Old May 21st, 2007, 01:35 PM   #27
samq12345
New Member
 
Join Date: May 07
Posts: 11
samq12345 is an unknown quantity at this point (<10)
Re: Need help with Excel web query

Did this work? What if I have 100+ stocks to go through?
samq12345 is offline   Reply With Quote
Old May 21st, 2007, 02:55 PM   #28
aclvsh
New Member
 
Join Date: Mar 07
Posts: 4
aclvsh is an unknown quantity at this point (<10)
Re: Need help with Excel web query

i delete all the temp internet files (IE7) everytime before i click the refresh all button, and delete them again and again as the update proceed. seems to reduce the error msg by 3/4 or more. i update 500+ entries everyday, so it is still a bit annoying.
aclvsh is offline   Reply With Quote
Old May 21st, 2007, 03:33 PM   #29
samq12345
New Member
 
Join Date: May 07
Posts: 11
samq12345 is an unknown quantity at this point (<10)
Re: Need help with Excel web query

ok thanks, I am sure one can write a code to delete the Temp files automatically
samq12345 is offline   Reply With Quote
Old May 21st, 2007, 03:44 PM   #30
aclvsh
New Member
 
Join Date: Mar 07
Posts: 4
aclvsh is an unknown quantity at this point (<10)
Re: Need help with Excel web query

haha, i was just about to ask how to delete temp files by macro (i m a newbie)

and it seems that the error is really related to temp files...just wrote a macro to do web query refresh and run into the same "run-time error 1004" problem, and the problem is gone once i delete the tem file.
aclvsh is offline   Reply With Quote
Old May 21st, 2007, 04:56 PM   #31
samq12345
New Member
 
Join Date: May 07
Posts: 11
samq12345 is an unknown quantity at this point (<10)
Re: Need help with Excel web query

no I don't but am trying to search the web for it. will post something if I come across something
samq12345 is offline   Reply With Quote
Old May 21st, 2007, 05:03 PM   #32
retsom
New Member
 
Join Date: May 07
Posts: 6
retsom is an unknown quantity at this point (<10)
Re: Need help with Excel web query

Here's something that explains how to delete temporary files within a VBA macro. (Of course, you have to delete the files from wherever YOUR computer stores the temporary files).

http://vbadud.blogspot.com/2007/04/d...ary-files.html
retsom is offline   Reply With Quote
Old May 22nd, 2007, 12:37 PM   #33
samq12345
New Member
 
Join Date: May 07
Posts: 11
samq12345 is an unknown quantity at this point (<10)
Re: Need help with Excel web query

hmm... so does this delete the entire folder? cause I have a lot of ramdom files in my temp folder, and the names of those file keep on changing.
samq12345 is offline   Reply With Quote
Old May 22nd, 2007, 12:43 PM   #34
samq12345
New Member
 
Join Date: May 07
Posts: 11
samq12345 is an unknown quantity at this point (<10)
Re: Need help with Excel web query

Is there a way I can go a the temp folder and select all files and then kill the files?
samq12345 is offline   Reply With Quote
Old May 22nd, 2007, 01:32 PM   #35
retsom
New Member
 
Join Date: May 07
Posts: 6
retsom is an unknown quantity at this point (<10)
Re: Need help with Excel web query

The code deletes all the files in the specified directory. That's what the wildcard character ('*') does.
retsom is offline   Reply With Quote
Old May 22nd, 2007, 01:33 PM   #36
retsom
New Member
 
Join Date: May 07
Posts: 6
retsom is an unknown quantity at this point (<10)
Re: Need help with Excel web query

I should say that, as written, that code will delete all the files of the form *.tmp. You can write the code however you want.
retsom is offline   Reply With Quote
Old May 22nd, 2007, 01:41 PM   #37
samq12345
New Member
 
Join Date: May 07
Posts: 11
samq12345 is an unknown quantity at this point (<10)
Re: Need help with Excel web query

thank you for the info, I am new at coding so have many dumb questions
I am using IE 7 as my default browser(which is accessed through excel while running a web query) and the code does not recognize my Temp file folder. Also I have this code in a module in excel should that make a difference?
samq12345 is offline   Reply With Quote
Old May 22nd, 2007, 02:44 PM   #38
samq12345
New Member
 
Join Date: May 07
Posts: 11
samq12345 is an unknown quantity at this point (<10)
Re: Need help with Excel web query

Here is what I found-the temporary file's folder for IE7 is a hidden folder and I cannot change the settings on that folder, thats the reason why the code won't work.

Is there a way around this?
samq12345 is offline   Reply With Quote
Old May 22nd, 2007, 03:05 PM   #39
retsom
New Member
 
Join Date: May 07
Posts: 6
retsom is an unknown quantity at this point (<10)
Re: Need help with Excel web query

Yeah, apparently the kill statement doesn't work on hidden files.

You could try this to unhide the folder:

Setattr "C:\Documents and Settings\.......\Local Settings\Temporary Internet Files", vbnormal

You have to replace the above path name with the specific folder in which your IE7 sames temporary files. The above command will make your Temporary Internet Files folder unhidden. You should then be able to use the kill command.
retsom is offline   Reply With Quote
Old May 22nd, 2007, 04:03 PM   #40
samq12345
New Member
 
Join Date: May 07
Posts: 11
samq12345 is an unknown quantity at this point (<10)
Re: Need help with Excel web query

The vbnormal statement works, but here is what happens-
1. the history is stored is a folder called "content.IE5" which has subfolders and the names of these subfolders (which are hidden) change so I can't kill these subfolders as they are hidden and I can't unhide them as their names change
2. the vbnormal statement unhides the folders but they are still "read-only" so I can't kill them. Is there another statement to uncheck the readonly property?

thank you in advance
samq12345 is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Office Development


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 02:51 PM.




To view more projects, click here

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.