Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 14th, 2012, 11:42 AM
Registered User
 
Join Date: Feb 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Application defined or Object defined error

Hi,

VBA macro which adds hyperlink into the spreadsheet was initially created in Excel 2003. I then saved that spreadsheet as excel 2010. Works perfectly fine for less data (row below 65k) but raise an error for anything greater than that. For instance, I have 70000 records, now macro runs fine and adds hyperlink to all 65532 records but then straight after it gets terminated with "Application defined or Object defined" error (number 1004). Following is the macro code. It would be really helpful if someone can help me



Sub AddHyperlinks()

Dim IDVal As Range
Dim IDQuant As Long
Dim CurrentSelection As Range

Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Set CurrentSelection = ActiveWindow.RangeSelection
IDQuant = CurrentSelection.Rows.Count

For rownum = 2 To IDQuant
Set IDVal = Range("A" & rownum)
Range("J" & rownum).Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
"http://www.nla-eclips.com/NLAAPI.dll/GetObject?ObjectID=" & IDVal, TextToDisplay:=CStr(IDVal)

Next rownum.
 
Old July 2nd, 2012, 03:35 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

Are you running this macro on XLS or XLSX file?

Regards
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Appl-defined or Object-defined error 1004 chp Excel VBA 3 April 4th, 2006 08:12 AM
Application Defined Error in Excel VBA mahanti BOOK: Professional Crystal Reports for VS.NET 0 May 27th, 2005 12:38 AM
object defined error piyushdabomb Excel VBA 1 February 1st, 2005 01:26 AM
Application-defined error Ned Pro VB 6 0 December 11th, 2003 01:55 PM
Application-defined or object-defined error James Excel VBA 1 August 12th, 2003 11:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.