PC Review


Reply
Thread Tools Rate Thread

ADODB Connection over HTTP

 
 
LDB
Guest
Posts: n/a
 
      14th Jun 2007
Hi,

I've currently got an ADODB connection to a CSV file on a fileserver
working over TCP-IP. My VBA looks something like this:

fname = "\\fileserver\directory\file.csv"

With resultLocation.Worksheet.QueryTables.Add(Connection:="TEXT;" &
fname, Destination:=resultLocation)
.attributes = blah
End With

However, the production of our CSV files is now automated as a cron
job on an AIX box and the only feasible way to access them (between
platforms) is accross HTTP. Can I get excel to easily connect over
this protocol, i.e. making my string filename string more like:

fname = "http://internal.server/directory/file.csv"

My first attempts have failed miserably - is this idea going anywhere?

Thanks,

Louis

 
Reply With Quote
 
 
 
 
joeu2004
Guest
Posts: n/a
 
      14th Jun 2007
On Jun 14, 6:34 am, LDB <l.br...@gmail.com> wrote:
> I've currently got an ADODB connection to a CSV file on a fileserver
> working over TCP-IP. My VBA looks something like this:


What book are you using?

I cannot find a book that has a good explanation of network access
using VBA.

> fname = "\\fileserver\directory\file.csv"
> With resultLocation.Worksheet.QueryTables.Add(Connection:="TEXT;" &
> fname, Destination:=resultLocation)
> .attributes = blah
> End With
> [....]
> However, the production of our CSV files is now automated as a cron
> job on an AIX box and the only feasible way to access them (between
> platforms) is accross HTTP. Can I get excel to easily connect over
> this protocol, i.e. making my string filename string more like:
> fname = "http://internal.server/directory/file.csv"


When I get stuck, I turn on macro record mode and try a similar
operation -- in this case, web query. Here is what I got:

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://bigcharts.marketwatch.com/historical",
Destination:=Range("A1"))

Hope that helps.

 
Reply With Quote
 
LDB
Guest
Posts: n/a
 
      14th Jun 2007
On 14 Jun, 15:53, joeu2004 <joeu2...@hotmail.com> wrote:
> On Jun 14, 6:34 am, LDB <l.br...@gmail.com> wrote:
>
> > I've currently got an ADODB connection to a CSV file on a fileserver
> > working over TCP-IP. My VBA looks something like this:

>
> What book are you using?
>
> I cannot find a book that has a good explanation of network access
> using VBA.
>
> > fname = "\\fileserver\directory\file.csv"
> > With resultLocation.Worksheet.QueryTables.Add(Connection:="TEXT;" &
> > fname, Destination:=resultLocation)
> > .attributes = blah
> > End With
> > [....]
> > However, the production of our CSV files is now automated as a cron
> > job on an AIX box and the only feasible way to access them (between
> > platforms) is accross HTTP. Can I get excel to easily connect over
> > this protocol, i.e. making my string filename string more like:
> > fname = "http://internal.server/directory/file.csv"

>
> When I get stuck, I turn on macro record mode and try a similar
> operation -- in this case, web query. Here is what I got:
>
> With ActiveSheet.QueryTables.Add(Connection:= _
> "URL;http://bigcharts.marketwatch.com/historical",
> Destination:=Range("A1"))
>
> Hope that helps.


Joe,

Thanks for your relpy.

Since posting I realised I can specify a 'URL' connection - this
works, however I cannot delimit by comma when I import! I don't really
want the whole line dumping in one cell.

Any other idea?

Thanks,
Louis

 
Reply With Quote
 
joeu2004
Guest
Posts: n/a
 
      14th Jun 2007
On Jun 14, 8:14 am, LDB <l.br...@gmail.com> wrote:
> On 14 Jun, 15:53, joeu2004 <joeu2...@hotmail.com> wrote:
> > When I get stuck, I turn on macro record mode and try a similar
> > operation -- in this case, web query. Here is what I got:

>
> > With ActiveSheet.QueryTables.Add(Connection:= _
> > "URL;http://bigcharts.marketwatch.com/historical",
> > Destination:=Range("A1"))

> [....]
> Since posting I realised I can specify a 'URL' connection - this
> works, however I cannot delimit by comma when I import! I don't really
> want the whole line dumping in one cell.
> Any other idea?


I am a relative "newbie" when it comes to network programming using
VBA. I'm afraid I don't know much about it.

But I can tell that you when I use Web Query on a table from a web
page, the data goes into separate cells.

So again, I would suggest that you do a Web Query with macro recording
mode enabled, then experiment with the many "extraneous" lines of VBA
code to see which ones, if any, are needed to distribute the data
among cells.

Then again, perhaps the problem is with the design of the web page,
not so much the VBA programming. I'm afraid I know nothing about HTML
programming either.

(Sigh, I'm a programming dinosaur. Ask me anything about Fortran ;-
>. Actually, I've forgotten all that, too. But C .... ;->.)


I know there a lot of knowledgable VBA programmers in these forums who
can help. Hopefully they will chime in and give you dispositive
answers.

 
Reply With Quote
 
LDB
Guest
Posts: n/a
 
      15th Jun 2007
On 14 Jun, 16:54, joeu2004 <joeu2...@hotmail.com> wrote:
> On Jun 14, 8:14 am, LDB <l.br...@gmail.com> wrote:
>
> > On 14 Jun, 15:53, joeu2004 <joeu2...@hotmail.com> wrote:
> > > When I get stuck, I turn on macro record mode and try a similar
> > > operation -- in this case, web query. Here is what I got:

>
> > > With ActiveSheet.QueryTables.Add(Connection:= _
> > > "URL;http://bigcharts.marketwatch.com/historical",
> > > Destination:=Range("A1"))

> > [....]
> > Since posting I realised I can specify a 'URL' connection - this
> > works, however I cannot delimit by comma when I import! I don't really
> > want the whole line dumping in one cell.
> > Any other idea?

>
> I am a relative "newbie" when it comes to network programming using
> VBA. I'm afraid I don't know much about it.
>
> But I can tell that you when I use Web Query on a table from a web
> page, the data goes into separate cells.
>
> So again, I would suggest that you do a Web Query with macro recording
> mode enabled, then experiment with the many "extraneous" lines of VBA
> code to see which ones, if any, are needed to distribute the data
> among cells.
>
> Then again, perhaps the problem is with the design of the web page,
> not so much the VBA programming. I'm afraid I know nothing about HTML
> programming either.
>
> (Sigh, I'm a programming dinosaur. Ask me anything about Fortran ;-
>
> >. Actually, I've forgotten all that, too. But C .... ;->.)

>
> I know there a lot of knowledgable VBA programmers in these forums who
> can help. Hopefully they will chime in and give you dispositive
> answers.



Joe,

Thanks for your help so far.

Unfortunately, I can't (or don't want to) edit the source of the data
to be imported - they are CSV files created by a monthly cron job
which are being hosted by Apache.

I'm currently doing the VBA-translation of a 'Web Query' (i.e.
Connection:="URL;...") but that only wants to dump my data into one
column, I can't distribute it along the cells horizontally - maybe I
need to go through and seperate by comma afterwards? Although that
sounds like an annoying way considering the number of lines my CSV
could span varies...

Louis

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set cnn = New ADODB.Connection burl_h Microsoft Excel Programming 4 17th Feb 2009 06:55 PM
ADODB over HTTP? LDB Microsoft Excel Programming 3 18th Jun 2007 09:15 AM
ADODB Connection Joe Delphi Microsoft Access 1 1st Sep 2006 07:32 AM
ADODB Connection =?Utf-8?B?RGFpdg==?= Microsoft Access VBA Modules 3 3rd Dec 2005 10:38 PM
dim ADODB.connection Dave Dawson Microsoft Access External Data 1 14th Jun 2005 07:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:05 AM.