需要帮助激活新下载的CSV [英] Need help activating a newly downloaded CSV

查看:109
本文介绍了需要帮助激活新下载的CSV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个项目,可以在一天(或几天)内从OpenDNS下载我的家庭网络所在域的完整列表。我有大部分工作,但有一件事一直困扰着我。


我无法从OpenDNS激活新下载的CSV文件来操纵它。我可以打开它,但即使我打开后停止我的代码,我也无法用VBA看到它。我尝试过(1)循环遍历所有打开的工作簿,(2)尝试激活它并处理任何错误,(3)使用立即窗口说出工作簿(其名称)。激活。 VBA无法看到它打开。


CSV文件不被视为工作簿吗?我可以循环浏览文本文件吗?任何其他的想法将不胜感激。


我很尴尬发布我的代码,因为它目前非常草率,但是......

展开 | 选择 | Wrap | 行号

解决方案

这是一个补充。 VBA绝对可以看到CSV文件(我应该知道)。但是......当我的代码正在进行时,它无法看到新下载的CSV。如果我停止代码,然后运行一个循环......那就是。


为什么它看不到那个CSV?


< blockquote>我找到了一个解决方案,并且工作实际上要快一点。我仍然希望我知道为什么CSV无法访问,但是......


我最终将CSV保存到我的下载文件夹,然后打开它。然后我当然可以完全控制它。


我认为你的terminonlogy是抛出的。人们。

CSV文件不是激活的东西。 - 这是静态的。

问: CSV文件不被视为工作簿吗?
答: - 否

问:我可以循环浏览文本文件吗?
答: - 是:主页>主题> microsoft access / vba>见解> vba标准文本文件i / o语句在本地驱动器上,根据您的需要打开文件以进行输入,可以是随机的,也可以是仅向前的记录集。 - 请记住,CSV 不是 数据库或工作簿。我也从未在超链接文档上尝试过标准IO语句,我怀疑这些语句在这种用法中会失败。


+ +虽然它们(CSV)可以在Excel,CSV是逗号分隔的 文本文件 。 Excel只是放置每个元素的例子。在它自己的单元格中,直到它到达行尾或其他指示元素组结束的标记;从而开始在工作表中的新行。您可以在Word,Notepad,Powershell或任何能够打开计划ASCII文本文件的程序中轻松打开CSV。


+ + IN在帖子1中你说你''我下载了文件;但是,在第3篇文章中,您说您的解决方法是下载文件。这没有任何意义。


+ +在您的代码块中没有任何地方您实际在excel中打开文档...您在线浏览到该文档;但是,你实际上从来没有真正打开它,我可以看到excel会识别出来......你的代码中也没有任何代码可以将文件下载到本地驱动器。


你需要类似的东西(这不是我的头脑,我自己也没试过 - 只是一个起点):

展开 | 选择 | 换行 | 行号


I am working on a project to download the full list of domains that my home network has been to in a day (or days) from OpenDNS. I have most of this working, but one piece keeps hounding me.

I can''t activate the newly downloaded CSV file from OpenDNS to manipulate it. I can get it open, but even when I stop my code after it is open, I can''t see it with VBA. I have tried (1) Looping through all of the open Workbooks, (2) Attempting to activate it and deal with any errors, and (3) Using Immediate window to say Workbooks("Its Name").Activate. VBA cannot see it open.

Are CSV files not considered Workbooks? Can I loop through text files??? Any other thoughts would be greatly appreciated.

I am embarrassed to post my code, because it is currently very sloppy, but...

Expand|Select|Wrap|Line Numbers

解决方案

Here is an addition. VBA can definitely see CSV files (which I should have known). BUT... It can not see the newly downloaded CSV while my code is in process. If I stop the code, and then run a loop... There it is.

Why would it not be able to see that CSV?


I found a work around, and the work around is actually a bit faster. I still wish I knew why the CSV was not accessible, but...

I ended up saving the CSV to my download folder, and then open it. I then of course had complete control of it.


I think your terminonlogy is "throwing" people.
A CSV file is not something one "activates" - it''s a static.

Q: Are CSV files not considered Workbooks?
A: - NO

Q: Can I loop through text files???
A: - Yes: home > topics > microsoft access / vba > insights > vba standard text file i/o statements On a local drive, open the file for input, depending on what you want, either as random or simply as a forward-only "record set" -- Keep in mind, the CSV is not a database nor a workbook. I''ve also never tried the standard IO statements on a hyperlinked document, I suspect that these will fail in such a usage.

+ +Although they (CSV) can be opened within Excel, the CSV is a comma delimited text file. Excel simply has the gumption to place each "element" in its own cell until it hits the end-of-line or some other marker that indicates the end of the element group; thus starting on a new row within the worksheet. You can just as easily open the CSV in Word, Notepad, Powershell, or any program capable of opening a plan ASCII text file.

+ + IN post 1 you say that you''ve downloaded the file; however, in post 3 you say that your workaround is to download the file. This doesn''t make any sense.

+ + Nowhere in your code block do you actually open the document in excel... You browse to the document on-line; however, you never actually open it in anyway that I can see that excel would recognize... nor does any of your code appear to down-load the file to the local drive.

You need something like (this is off the top of my head, I haven''t tried this myself - just a starting point):

Expand|Select|Wrap|Line Numbers


这篇关于需要帮助激活新下载的CSV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆