Jan 13 2020 04:50 AM
I have an Excel spreadsheet which contains macros, three of which access files on the digitallook website. I run the macros every weekend. They have worked well for years but, last weekend, Excel started to tell me it couldn't access the file. However, if I paste the filename manually into my browser (Safari), the file opens as normal.
Is there some setting I need to change to get my macros working again?
The offending line in the macro is:
Workbooks.Open FileName:=strFilename
where strFilename contains the string:
Any ideas would be gratefully received.
Thanks.
David
Jan 13 2020 06:58 AM
Jan 13 2020 07:04 AM
Jan 13 2020 07:05 AM
Works fine with data import @David89A
Jan 13 2020 08:51 AM
Hello @PascalKTeam ,
Thanks for your quick response. You asked if it is necessary always to extract the last 365 days. In fact, I only need to cover the time since the last update which is usually a week. However, it isn't always a week (I often miss a week or two if I'm away from home) so I made it longer than I am ever likely to need. Also, making it one year means I only have to change the year part of the date which, unlike the month, is always less than the current date. The macro later works out which data I have already got and discards the rest. However, determining the optimum amount of data to extract isn't really the problem, it's getting the file to open in the first place.
Your second response is interesting. It would be relatively easy for me to reprogramme the macro to use Get Data instead of Open File. However, I couldn't get it to work on my computer because I don't have the "Data from web" icon in my ribbon. Is that because I'm using Excel 365 for Mac? If not, how do I find it?
Thanks again for your help.
Jan 13 2020 08:57 AM
SolutionThe thing is that if you use data import from web, you don't need the VBA to load the data anymore. you would simply refresh the data you load....
I don't know Excel for Mac but maybe you can find the option like this (see video)
Jan 13 2020 09:09 AM
Dear @PascalKTeam ,
I see. My Excel for Mac ribbon offers far fewer options than yours in the videos you sent. However, I'm sure there must be a way to do it. I'll have a bit of web-browse and see if I can find it.
I noticed I'd missed a question you asked earlier; namely about whether it has ever worked in 2020. Yes, it worked fine last week on the 4th of January and accurately downloaded data covering the year end. Something has changed since then: I know it's not my macro but I can't find out what it is.
Your suggestion about the automatic update looks like a better solution to the problem, however, so I'll pursue that. Thank you again.
Jan 14 2020 01:52 AM
Jan 14 2020 04:00 AM
Dear @Jan Karel Pieterse ,
Thanks for the link. Unfortunately, I can't get it to work for me for the same old reason - the icons on the ribbon are missing from my Excel version (for Mac). Also, this article appears to cover imports from an existing file, rather than a web page. If you find anything on how to import from a website's database into Excel 365 for Mac, then I'd be grateful if you'd let me know.
Thanks for your help so far.
Jan 14 2020 04:32 AM
@David89A If you open the attached, are you able to refresh the data?
Jan 14 2020 08:33 AM
Dear @Jan Karel Pieterse ,
I opened the attachment you sent. It opened as an Excel spreadsheet with the six column headings but no data. It also came with a "Security Warning" which said, "External Data Connections have been disabled" and a button labelled "Enable Content". I clicked the button but nothing changed on the spreadsheet.
Does this help to diagnose the original problem?
Jan 14 2020 08:37 AM
I clicked the "Refresh All" icon in my Data ribbon and received the message in the attached. I don't understand it. Can you decipher it?
Jan 14 2020 10:03 AM
Feb 20 2020 04:19 PM
Dear @Jan Karel Pieterse
Thanks for your info. I suppose we'll just have to wait until Microsoft gets around to repairing its software.
Jan 13 2020 08:57 AM
SolutionThe thing is that if you use data import from web, you don't need the VBA to load the data anymore. you would simply refresh the data you load....
I don't know Excel for Mac but maybe you can find the option like this (see video)