473,406 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Open an excel file downloaded from a know website

1
Hi All,

I'm trying to import an Excel file opened using this code:
Expand|Select|Wrap|Line Numbers
  1. 'Crea oggetto Internet Explorer e Excel
  2. Set IE = CreateObject("InternetExplorer.Application")
  3.  
  4. 'Uploading Wedsite
  5. IE.Navigate "http:Mywebsite.it"
  6.  
  7. While IE.Busy
  8. DoEvents
  9. Wend
  10. IE.Visible = False
  11. 'User-ID & password
  12. IE.Document.All("Operatore").Value = UserName
  13. IE.Document.All("Password").Value = Password
  14. 'Click on login button
  15. IE.Document.All("OK").Click
  16.  
  17. While IE.Busy
  18. DoEvents
  19. Wend
  20.  
  21. 'Positioning on the webpage
  22. 'Clicca sul pulsante di "Richieste di intervento"
  23. IE.Navigate "http:Mywebsite.it,ta=lst"
  24.  
  25. While IE.Busy
  26. DoEvents
  27. Wend
  28.  
  29. 'Click on button to open the excel file in a new 
  30. IE.Document.All("btn_scheda").Click
  31.  
  32. While IE.Busy
  33. DoEvents
  34. Wend
  35.  
  36. 'inserted a delay in order to be sure that the excel file has been opened
  37. Application.Wait TimeSerial(Hour(Now), Minute(Now), Second(Now + TimeValue("00:00:10")))
  38.  
  39. Dim strFile As String
  40. Dim i As Long
  41. Dim TargetSht As Worksheet
  42. Dim LastRow As Integer
  43.  
  44. 'SET (REMEMBER) CURRENT SHEET AS TARGET SHEET
  45. Set TargetSht = ActiveSheet
  46. strFile = Excel.Application.GetOpenFilename("RINT_Lista_Interventi1 (*.xls),*.xls", _
  47. MultiSelect:=False)
At the end:
- TargetsSht has no values ...
- i don't want to open a search box, but only to select my new Excel file "RINT_Lista_Interventi1 " and copy/paste data
Jun 19 '13 #1
1 1186
Mihail
759 512MB
From where are you running this code ?
At what time in Excel life are you running the code ?
Are you sure that when you run the code is any sheet activate ?

In order to debug, insert, before line 1, this code:
Expand|Select|Wrap|Line Numbers
  1. Dim TargetSht As Worksheet
  2.     Set TargetSht = ActiveSheet
  3.     MsgBox (TargetSht.Name)
If MsgBox will return a name then something happen in your code. And all I can see wrong is that Excel Application lost focus (IE gain the focus). If so, you must reactivate the Excel application before stetting TargetSht as active sheet.

Cheers !
Jun 22 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Micke | last post by:
Hi, I'm trying to open an Excel file from an aspx with following code: Imports Excel = Microsoft.Office.Interop.Excel Dim oExcel As New Excel.Application Dim oBooks As Excel.Workbooks...
1
by: dele.olowoyo | last post by:
Hey All, I am trying to open an Excel file in a browser by using Response.Redirect. The file is located in a virtual directory. However, the browser title shows the path of the file, which I...
1
by: Raggie | last post by:
Gentlemen, first of all I have a general question... is it possible to open an excel file directly through the ASP.NET page without to install Excel on server? I tried something on my...
3
by: jnb0012 | last post by:
Can anyone help with this? Here is the code I am using. The problem is, where it checks if a file exists, it always goes to else. Even if the file is there, it won't open the file, goes straight...
2
by: Peter S. | last post by:
I have an ASP.NET page that invokes a web control written in C#. What I want to do is (based on the session ID) display a certain spreadsheet that exists on a network drive. I want the webcontrol...
1
by: NH | last post by:
Hi, I am sure this must be simple do (famous last words?!). I have an excel file in a folder on the website and I just want to have it open up immediately (in an iframe or something?) once the...
1
by: anuragNet | last post by:
Hi, I have an excel file,having lot or micros, connecting to database, doing some complex calculation..inshot that excel file is itself an application. Now I want to open that excel in VB.net form,...
1
by: ABC | last post by:
Hi, I found many methods to download attachment files, but I cannot found any to force the browser open excel file if the download is excel type. Is there any reference or tutorial on internet?
1
by: barry.zhao | last post by:
Hi, I have a python program that constantly updates an excel spreadsheet. I would like to be able to view its updates while using excel to edit other excel files. Below are the test codes I...
1
Soniad
by: Soniad | last post by:
Hi, I want to open an excel file from ASP Page, direclty. Means, Now I can open excel file on onclick by giving its path. But,it's prompting a dialog box with "Open/Save/Cancel" Option. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.