Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Importing spreadsheets

How can I import an Excel spreadsheet from the web into a current worksheet?

We have a company intranet with a link to an Excel spreadsheet that is
updated often. I would like to create a macro to go out to the site and pull
the spreadsheet into one of my spreasheets.

Any help would be great.

Thanks
Mike


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 139
Default Importing spreadsheets

Mike:

You Can Downlond This Workbook and copy Sheet

example:

'Module
Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal pCaller As Long, ByVal strURL As String, _
ByVal strFileName As String, ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long

Sub DownFile()
Dim lReturn As Long
Dim URL As String
Dim fname As String
Dim wbk As Workbook
URL = "http://vba.com.tw/file/Book1a.xls"
'Workbook must save
fname = ThisWorkbook.Path & "\temp.xls"
lReturn = URLDownloadToFile(0, URL, fname, 0, 0)
If lReturn < 0 Then Call MsgBox("connect error"): Exit Sub
Set wbk = Workbooks.Open(fname)
wbk.Worksheets("Sheet1").Copy After:= _
ThisWorkbook.Worksheets("Sheet1")
wbk.Close SaveChanges:=False
Kill fname
End Sub

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"Mike" wrote:

How can I import an Excel spreadsheet from the web into a current worksheet?

We have a company intranet with a link to an Excel spreadsheet that is
updated often. I would like to create a macro to go out to the site and pull
the spreadsheet into one of my spreasheets.

Any help would be great.

Thanks
Mike


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Importing spreadsheets

When i run it this is what comes up in "debug" (see yellow)

'Module
Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal pCaller As Long, ByVal strURL As String, _
ByVal strFileName As String, ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long

Sub DownFile()
Dim lReturn As Long
Dim URL As String
Dim fname As String
Dim wbk As Workbook
URL =
"http://portico.corp.erac.com:7778/pls/portal/frame01.efqi_survey/region data
export (excel)"
'Workbook must save
fname = ThisWorkbook.Path & "\temp.xls"
lReturn = URLDownloadToFile(0, URL, fname, 0, 0)
If lReturn < 0 Then Call MsgBox("connect error"): Exit Sub
Set wbk = Workbooks.Open(fname)
wbk.Worksheets("EFQI VIEW 1").Copy After:= _ <-------yellow
ThisWorkbook.Worksheets("EFQI VIEW 1") <-------yellow
wbk.Close SaveChanges:=False
Kill fname
End Sub

"chijanzen" wrote:

Mike:

You Can Downlond This Workbook and copy Sheet

example:

'Module
Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal pCaller As Long, ByVal strURL As String, _
ByVal strFileName As String, ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long

Sub DownFile()
Dim lReturn As Long
Dim URL As String
Dim fname As String
Dim wbk As Workbook
URL = "http://vba.com.tw/file/Book1a.xls"
'Workbook must save
fname = ThisWorkbook.Path & "\temp.xls"
lReturn = URLDownloadToFile(0, URL, fname, 0, 0)
If lReturn < 0 Then Call MsgBox("connect error"): Exit Sub
Set wbk = Workbooks.Open(fname)
wbk.Worksheets("Sheet1").Copy After:= _
ThisWorkbook.Worksheets("Sheet1")
wbk.Close SaveChanges:=False
Kill fname
End Sub

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"Mike" wrote:

How can I import an Excel spreadsheet from the web into a current worksheet?

We have a company intranet with a link to an Excel spreadsheet that is
updated often. I would like to create a macro to go out to the site and pull
the spreadsheet into one of my spreasheets.

Any help would be great.

Thanks
Mike


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing EXCEL Spreadsheets into ACCESS -- Macro or VBA? Excel Worksheet Functions 0 July 12th 06 10:08 PM
Importing EXCEL Spreadsheets into ACCESS -- Macro or VBA? Excel Discussion (Misc queries) 0 July 12th 06 10:08 PM
Importing Excel spreadsheets Mike Excel Discussion (Misc queries) 0 November 28th 05 02:30 PM
Importing from access database into multiple spreadsheets Sandy Excel Discussion (Misc queries) 1 September 8th 05 03:55 AM
importing data from multiple excel spreadsheets Geuis Excel Programming 1 July 12th 04 01:29 AM


All times are GMT +1. The time now is 08:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"