How Can I Get Data From The Internet?

K

Kenji

I tried using this

Sub URL_Get_Query()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://webservices.pcquote.com/cgi-" & _
"bin/excelget.exe?TICKER=msft", _
Destination:=Range("a1"))

.BackgroundQuery = True
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.SaveData = True
End With
End Sub

This works on Windows/Excel, but does not work on the Mac.

For the MAC, it crashes out. WHYYY~ =(

Kenji
 
J

Jim Gordon MVP

Hi Kenji,

The QueryTable method on the Mac expects that you will be using ODBC with an
ODBC driver.

The more generic way to create a web query that works both Mac and windows
is to create a text file, give it a .iqy extension, then put it into the
Queries folder.

Here's an example web query that you can save as a text file with .iqy
estension:

WEB
1
http://moneycentral.msn.com/investor/external/excel/quotes.asp?SYMBOL=["QUOT
E","Enter stock, fund or other MSN MoneyCentral Investor symbols separated
by commas."]

Selection=EntirePage
Formatting=All
PreFormattedTextToColumns=True
ConsecutiveDelimitersAsOne=True
SingleBlockTextImport=False

-Jim Gordon
Mac MVP

All responses should be made to this newsgroup within the same thread.
Thanks.

About Microsoft MVPs:
http://www.mvps.org/

Before posting a "new" topic please be sure to search Google Groups to see
if your question has already been answered.

An Excel add-in is available to help with this task.
<http://www.rondebruin.nl/Google.htm>
 
F

Fred

Hi, Jim!

I would appreciate your assistance with removing unwanted spaces
(Excel 2001),

when retrieving one column of numbers from the internet, using
Copy-Paste.

(These numbers are two place decimals, and are already in
    Tab-Delimited columns).

    i.e.:
           5.3
           .35
           1.65
           .83

    etc.

To date, I have been deleting the unwanted spaces, one cell at a time.


          There 'must' be a quicker way than that! Right?


I want Excel to ignore all spaces 'after' these numbers, as I Paste!



I went to Microsoft's Knowledge Base:
............................................................................................................................................
Method 4: Remove Hidden Characters and Spaces

This method works best if the data is arranged in a single column or
row. This technique uses the TRIM function and the CLEAN function to
remove extra spaces and nonprinting characters that may be imported
with the file. The following example assumes that the data is in
column A and starts in row 1 ($A$1). To use this example, follow these
steps:

1. Insert a column to the right of column A by selecting column B and
clicking Columns on the Insert menu.

2. In the first cell of the inserted column (B1), type the following:

$B$1: =VALUE(TRIM(CLEAN(A1)))

3. In column B, select all the cells to the right of the cells that
contain data in column A.

4. On the Edit menu, point to Fill, and then click Down.

The new column contains the values of the text in column A.

5. With the same range selected, click Copy on the Edit menu.

6. Select cell A1, and click Paste Special on the Edit menu. Under
Paste, click Values, and click OK to paste the converted values back
on top of column A.

7. Delete column B by selecting the column and clicking Delete on the
Edit menu.
The text that was in column A is in a number format.
.............................................................................................................................................


This didn't work!

Numbers in my Column A, that were automatically placed by Excel as
left aligned
(due to spaces after the number, and thus treated by Excel as text )
returned: #VALUE!


So, I tried:
............................................................................................................................................
Method 6: Use Text to Columns
This method works best if the data is arranged in a single column. The
following example assumes that the data is in column A and starts in
row 1 ($A$1). To use this example, follow these steps:

1. Select one column of cells that contain the text.

2. On the Data menu, click Text to Columns.

3. Under Original data type, click Delimited, and click Next.

4. Under Delimiters, click to select the Tab check box, and click
Next.

5. Under Column data format, click General.

6. Click Advanced and make any appropriate settings for the Decimal
separator and Thousands separator. Click OK.

7. Click Finish.


The text is converted to numbers.
..........................................................................................................................................


This didn't do anything to the numbers, or the spaces! No change!

Just changing the format to General, or Number, doesn't work either!


Thanks for your help!

Fred
 
F

Fred

Hi again, Jim!

In my last post, I neglected to tell you that I 'did' consult

Excel 2001's 'Help':


............................................................................
To Change Text (Numbers) to a Numeric Value:


Select a blank cell that you ‘know' has the General format…

In that cell, type the number one (1), and the press RETURN.

Click on that cell, and then, in the Edit menu, choose Copy.

Drag down the range of cells that contain the text (left aligned) numbers.

In the Edit menu, choose "Paste Special", and in the box, select "Multiply".

Then, click "OK".
..............................................................................


That didn't work either!



Thanks again, …for your help!

Fred
 
J

Jim Gordon MVP

Hi

If the numbers were originally formatted as numbers on the internet and they
are in a table, then a web query is probably the best way to go.

You can simply paste the URL of the target web page into this free template:
http://www.versiontracker.com/dyn/moreinfo/macosx/18898

Or, from your web browser choose to View the HTML source code. Use
Edit>Select All, the Edit > Copy to copy all of the HTML code. Switch to
Excel and use Edit > Paste to paste the code into any cell. Excel will do
the work of creating the HTML tables for you.

-Jim Gordon
Mac MVP

All responses should be made to this newsgroup within the same thread.
Thanks.

About Microsoft MVPs:
http://www.mvps.org/

Before posting a "new" topic please be sure to search Google Groups to see
if your question has already been answered.

An Excel add-in is available to help with this task.
<http://www.rondebruin.nl/Google.htm>

----------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top