Open Web Page Macro Code

Mar 5, 2008

I am currently using the following code in order to open a web page by clicking a button:

Private Sub Timetable18_Click()

ActiveWorkbook.FollowHyperlink Address:="http://journeyplanner.tfl.gov.uk/user/AHF/JP15__00006e8e.pdf"
NewWindow = True

End Sub

However, when this is executed it returns the following error:

Run-time error '-2146697210 (800c0006)':
Method 'FollowHyperlink' of object '_Workbook' failed

Clearly, I'm doing something wrong. I wondered if it had anything to do with the fact that the webpage I'm trying to open is a pdf and not html or similar, but this doesn't appear to be the issue.

View 4 Replies


ADVERTISEMENT

Open Web Page Via Macro Code

Feb 24, 2008

I have been looking for some VBA code that simple, when it runs, opens a browser and a specific, hard coded website. Is this possible in VBA?

View 2 Replies View Related

Macro Code To Log Onto Web Page Form

Aug 9, 2008

Im using information from oracle to do applications on excel. As im nothing related to IT department and I'm working on a BIG company, i did it by myself, i dont have support.

What i did is to investigate about oracleas (portal), then from my excel application i create the URL of the search i need, query it and paste on the document the table i need. I did this from months and worked great.

But now portal have been upgraded and need to do login before use it. I have some amateur knowledge about some HTML, PHP, CSS but i dont get how to fill the username and password for this new portal.

I will copy part of the code from portal that i think is the key:


<SCRIPT TYPE="text/javascript">
<!-- Comment out script For old browsers
Function setFocus()
{

document.forms[0].ssousername.focus();

};
window.onload = setFocus;
//-->
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>

<TABLE WIDTH="90%" BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD>
<BLOCKQUOTE>
<BLOCKQUOTE>......

View 9 Replies View Related

VB Code/Macro Printing With Page End Pulled From Workbook

Oct 29, 2008

I have a worksheet that changes in length. There is a formula that calculates how many pages the sheet will be. The also is a print button on the sheet that will print a coversheet "Sheets("Title")" and then it is supposed to print the data on the second sheet. Below the code I have so far... I know I am missing something, but knowing very little about macros I just can't seem to figure it out.

View 2 Replies View Related

Macro Coding: Add A Code To The Sort And Paste Macro That Will Open The Second Spread Sheet

Jul 21, 2007

I am making a spreadsheet that sorts and pastes, but I need to know if I can add a code to the Sort and Paste Macro that will open the second spread sheet needed without just already having it open and using the

Windows("estimate sheet one.xls").Activate

View 2 Replies View Related

Printing One Page Grayscale And One Page Color With Code

May 21, 2009

I have a report that I use and right now I have a command button that prints the report x2. What I would like to do is to have it print one in color and one in grayscale. I could do this I think with two different buttons, but I would like to utilize just one. I tried creating a macro but it did not pick up the fact that I changed the properties to black and white.

View 2 Replies View Related

VBA Code To Run Macro In All Open Workbooks

Mar 12, 2014

I have a macro to get copy of sheet named "Doc Info" from workbook File 1 to active workbook.

I could do it for one file on any active workbook.

But what I would require is, upon executing this macro , i want this macro to get executed in all open workbooks( could be any numbers ).

I want to move copy of sheet from File 1 to all open workbooks ( which i am doing it manualy for every file )

All these open workbooks could be from any folder , wont be in same folder.

So logic is to execute my macro apply in all open workbooks in my computer.

Below is the code and i have attached file for test

HTML Code: 

Sub Copysheet()
Dim wSht As Worksheet
Dim wBk As Workbook
Dim wBk1 As Workbook

Set wBk = ActiveWorkbook 'Workbooks("File 2.xls")
Set wBk1 = Workbooks("File 1.xlsm")
Set wSht = wBk1.Sheets("Doc Info")

wSht.Copy before:=wBk.Sheets(1)

End Sub

View 2 Replies View Related

Macro Code - Open As Read Only

Jan 21, 2009

below code

Sub Collect_OS_Data()
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Dim fso As Object, fld As Object, fil As Object, fldPath As String, wbSrc As Workbook, wbCur As Workbook
fldPath = "Q:PublicPAYMENTS Q&RREPORTSSuspense Activity BUSINESSOngoing - Suspense BUSINESS - Activity Reports"
Set wbCur = ActiveWorkbook
ActiveSheet.Name = "Raw Data"
Set fso = CreateObject("Scripting.FileSystemObject")
Set fld = fso.getfolder(fldPath)
On Error GoTo ErrHandler
For Each fil In fld.Files

This opens all spreadsheets within a folder and takes the data i require out of each one and pastes to a new workbook, however the files are password protected. Can you add into the code to open each spreadsheet as a readonly copy and paste data and then close without a save prompt or denying the save prompt ?

View 9 Replies View Related

Open A Pdf File In Macro Code

Aug 11, 2004

how to open a pdf file (located: "C:myfile.pdf") in macro code?

View 4 Replies View Related

Open/Add New Workbook Macro Code

May 12, 2008

I am trying to write code to open a new (blank) workbook while in an existing workbook (I am then going to pass data between the two which is easy). When I try to record the code to get the syntax for opening a new workbook it will not record any code. I also need to name the new workbook based on text in a cell in the existing workbook. I just saw before posting this that the code;

workbooks.add

will open a new workbook now I just need to name the new workbook based on text in my existing workbook.

View 2 Replies View Related

Macro Code To Work Between 2 Open Workbooks

Jun 4, 2008

I am trying to simultaneously use two Excel workbooks that are open at the same time--one is calculations--other is data scenarios...one worksheet = one scenario: A macro uses "Set" to specify workbooks for "current_wb" and "wbkFrom". Code here

Set current_wb = ThisWorkbook
Dat_Fil = Application. GetOpenFilename
Workbooks.Open Dat_Fil
Set wbkFrom = Application.ActiveWorkbook

NOTE-Workbook object variables are declared outside any macro, and as "public." Code here

Public current_wb As Workbook
Public wbkFrom As Workbook

In a second macro I want to use the Current_wb and wbkFrom object variables I set in first macro, but get the following error: "object variable or With block variable not set" for any of the following statements in the second macro

current_wb.Activate
current_wb.Worksheets(1).Select
wbkFrom.Activate

I've declared the object variables as public in a different code module where there is no other code; I've tried declaring as public at the top of the code module that has my macros, but declared at top of code module and outside any macro; I've tried declaring the object variables as "static" variables (instead of "public") within the first macro. I can't figure this out.

View 4 Replies View Related

Open Hyperlink In Cell With Macro Code

Aug 7, 2008

how to open a Hyperlink directly. I have writen some code which allows me to copy over certain cells from a large list of hyperlinked files. However I am struggling to figure out how to open the hyperlink without actually writing the hyperlink address into the code. The hyperlinks are the file names and not the file paths. In essence I'm aiming to just get the macro to "click" the hyperlink to open it. Once the file is open the rest of my code will work, it is just this one sticking point.

View 2 Replies View Related

Macro To Print Page Based On Active Page

Jun 29, 2007

I need a macro that will print a hidden page that is linked to the page I have active.

It needs to be able to find the correct hidden page that corresponds to the active page because there are multilple pairs of the hidden/visible pages. The name of the hidden page is the same as the visible one with "printout" added to the end. When created, the sheet code names are sheetn and sheetm; n and m being consecutive numbers.

View 3 Replies View Related

2002 Code V 97 Code: Add A Small Workbook Open Event Code Which Works For Me But Debugs For The Others

Jan 27, 2009

I use excel 2002 but some of my office are on 97, i want to add a small workbook open event code which works for me but debugs for the others?? The code is basically, go to a tab, on that tab and that range sort..

View 2 Replies View Related

Open To A Particular Page

Dec 5, 2008

Excel 2003 Userforms

Userforms contains a MultiPage object

when opening this userform I want it to always open to the first page (multipage1(0)).

however it does not get the opening focus of that userform (Opening focus will be on a txt box NOT on the multipage object)when the form is opened.

View 2 Replies View Related

Sort Page On Open

Mar 31, 2009

Due to the protection function, users cannot sort by descending (using filter), and this is causing some problems. So I was wondering if it were possible for the sheet to be sorted automatically whenever the spreadsheet is opened. Is this a viable solution?

The sheet is titled Summary (Sheet 1), and the range is A4:CI301 and I would like to sort based on the data in column C, in Descending order (C4 - C301).

Like I said, I'm not sure if this is the best method or not, so I am open to any suggestions that may be applicable.

View 9 Replies View Related

Open An Internet Page

Nov 15, 2006

I have tried to open an internet page usin excel in order to get some information, for this I wrote the following code which doesn't work:

Dim i As Integer
For i = 2 To 3000
Workbooks.Open Filename:="http://www.anm.ro/anm/anm_maint.asp?anmPage=2&ID=i"
Application.Goto Reference:="R12C3"
Range("C12:C25").Select
Selection.Copy
ActiveWindow.ActivateNext
ActiveCell.SpecialCells(xlLastCell).Next.Select
ActiveSheet.Paste
ActiveWindow.ActivateNext
ActiveWorkbook.Close
Next
End Sub

How can I make so that, this procedure to open page with ID 2, and 3and so on

View 2 Replies View Related

How To Check If Website Is Open And Also Navigate To Another Page

Oct 12, 2011

I am using the below code to login to a website from Excel when I close a userform.

What I now need is a way to check if the website is already open to prevent the code from running and I also would like to navigate to another page on the website once its logged in. The web address of the other page is:

[URL]

Sub LogInToRoyalMail()
Const cURL = "http://www.XXXXX.co.uk/" 'Enter the web address here
Const cUsername = "XXXXXX" 'Enter your user name here
Const cPassword = "XXXXXX" 'Enter your Password here

[Code].....

View 1 Replies View Related

Show Page Breaks Automatically When I Open A New File.

Jul 10, 2008

I want to make Excel show page breaks automatically when I open a new file. Please tell me how to do that. I tried changing the book.xlt and sheet.xlt files, but to no avail. I am using Excel 2003.

View 9 Replies View Related

IE6 Automation In VBA - Open A (child) Page On Clicking A Button In Main (parent)

Jan 29, 2010

My query is regarding internet explorer 6 automation via code in VBA (Excel 2003). I'm trying to open a page on clicking a button in main page.

I'm able to open both parent and child pages via VBA, but now want to automate events (like radio btn click etc) in child page.

below is my initial code -

'========
Sub ListLinks()
Dim IeApp As InternetExplorer
Dim sURL As String
Dim IeDoc As Object
Dim i As Long

'Create new instance of IE
Set IeApp = New InternetExplorer

View 9 Replies View Related

Page Break Preview It Shows The Page Numbers In The Centre Of The Page

Jun 9, 2009

When I view a sheet under Page Break Preview, it shows the Page numbers in the centre of the Page. While I am aware that it would not print the page number I was wondering if there is an option to remove/hide the page numbers.

View 3 Replies View Related

Code Is Creating A New Page?

Oct 30, 2008

For some reason the following code creates a blank page everytime. Is there a way to have it not do this that I am not seeing?

View 2 Replies View Related

Navigate In Ie Using Source Code In Web Page

Oct 13, 2006

i am trying to make excel open a web page then naviagte to a link. I know how to do this if the link has the same address all the time using

Set ie = CreateObject("InternetExplorer.Application")

With ie
.Visible = True
' Go to web page
.navigate [url]

Do Until .readyState = 4
DoEvents
Loop

but how could I navigate to a link which continually changes.

for example on a web page the link always shows "report", but the actual address may changes say every hour.

Is there a way to navigate to what ever address sits behind "report"

View 9 Replies View Related

Use Code To Determine Files On Web Page?

Sep 16, 2006

I need to build an Excel application that allows a user to select and download files from a website. The files change daily. Is there a way in VBA to obtain the current list of files that are available for downloading?

View 4 Replies View Related

Code To Find The Last Row In A Dynamic Page

Apr 27, 2007

I have a task that pulls out information from the website. I need to write a vba code to find the last row. Since the no of rows are always not the same. I would need the excel masters help to solve it. Just a small piece of guidance would also help me.

In my work sheet I need to find the word " Function Name: Cleaning" if this is there then I should find the occurence of the word " name". If I find that then the code should copy the values in the column after name till it sees a space ( means no value). Should copy till that and paste that in another work sheet.

View 9 Replies View Related

Macro -open The Look In List” And Stop So I Can Pick A File To Open

Oct 18, 2008

I want to create a macro that will “open the look in list” and stop so I can pick a file to open. I’ve tried to use “record a macro” and “ctrl-o”, but the record a macro won’t stop until I pick a file or cancel the file list. I also tried to use “o” in the short cut key box

View 5 Replies View Related

VBA Code - Userform Needs To Select Specific Page

Oct 24, 2011

The issue I am having is that the code fails if there is ever a "sheet2" left open. I need it to always target the sheet Data5m.

What seems to happen is the sheet targets the first available sheet. This book only consists of 1 sheet, but generates other sheets later, sometimes extra sheets are left open.

Microsoft Excel Objects - This Workbook code

'The following is for the Userform DataReport code

DataReport.ComboBox1.Clear
Columns("N:N").Select
Range("A2:HX29921").Sort Key1:=Range("N2"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Data5m.Range("A1").AutoFilter
Call FillCombobox(Data5m.Range("N2", Data5m.Cells(Rows.Count, "N").End(xlUp)), DataReport.ComboBox1)
DataReport.Show
End Sub

Forms - DataReport

Code:

Private Sub ComboBox1_Change() 'was A, now N
DataReport.ComboBox2.Clear
If Data5m.FilterMode = True Then: Data5m.ShowAllData
Data5m.Range("A1").AutoFilter field:=14, Criteria1:="=" & DataReport.ComboBox1.Value
Call FillCombobox(Data5m.Range("X2", Data5m.Cells(Rows.Count, "X").End(xlUp)).SpecialCells(xlCellTypeVisible), DataReport.ComboBox2)

[Code] ..........

View 1 Replies View Related

Getting The Entire HTML Source Code From A Web Page

Feb 12, 2010

I am looking to read the source code for a website that keeps the stats for a hockey league in Sweden

For other sites i can use the code below and it works fine, but the site i am using to get the Sweden stats seem to keep the data in some type of a Java app (sorry still somewhat of a newbie) and doesn't work the same as the others

when i veiw the source code just by right clicking the page all the data i want shows up. When i try to use my code it doesn't get the stuff i want.

I have tried both objDoc.body.innerHTML and objDoc.body.outerHTML and i get different results but not the same as right clicking on the page and viewing the source, is there another command that i can use to get it all?

the website is

HTML [url]

Sub Get_Stats()
Const strURIpre As String = [url]
Set ie = CreateObject("internetexplorer.application")
ie.Navigate strURIpre
Do
If ie.ReadyState = 4 Then
ie.Visible = False
Exit Do
Else

View 9 Replies View Related

VBA Code To Activate/Press Button On Web Page

Jul 6, 2009

VBA Code To Activate/Press Button On Web Page. press a button on web page using VBA

View 4 Replies View Related

Macro: Clear Page Breaks & Add Page Breaks

Nov 28, 2006

I need to remove all existing page breaks in a document and add a page break every 72 rows. I've tried some similar codes from this forum with other functions that I don't need in it.

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved