From: PPL on 17 Mar 2010 19:52 Excel 2002 / 2003. I'm trying to create a hyperlink in cell A19 such that the result opens in a new window. I'm using Range("A19").Select ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="c:\test.htm", NewWindow:=True, AddHistory:=True I'm getting Runtime Error 1004: Application defined or Object defined error Anyone any idea where am I going wrong ??? TIA
From: Dave Peterson on 17 Mar 2010 20:33 When I look at VBA's help for the Add method for Hyperlinks, I see this: Add method as it applies to the Hyperlinks object. Adds a hyperlink to the specified range or shape. Returns a Hyperlink object. expression.Add(Anchor, Address, SubAddress, ScreenTip, TextToDisplay) expression Required. An expression that returns a Hyperlinks object. Anchor Required Object. The anchor for the hyperlink. Can be either a Range or Shape object. Address Required String. The address of the hyperlink. SubAddress Optional Variant. The subaddress of the hyperlink. ScreenTip Optional Variant. The screen tip to be displayed when the mouse pointer is paused over the hyperlink. TextToDisplay Optional Variant. The text to be displayed for the hyperlink. ====== I don't see NewWindow or addhistory parms. I think you've gotten these parms confused with .FollowHyperlink's parms. PPL wrote: > > Excel 2002 / 2003. > I'm trying to create a hyperlink in cell A19 such that the result opens in a > new window. I'm using > > Range("A19").Select > ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="c:\test.htm", > NewWindow:=True, AddHistory:=True > > I'm getting Runtime Error 1004: Application defined or Object defined error > > Anyone any idea where am I going wrong ??? > > TIA -- Dave Peterson
From: Brian on 17 Mar 2010 21:48 Try.... Sub Test2() ActiveSheet.Range("A19").Select With ActiveSheet .Hyperlinks.Add Anchor:=Selection, Address:= _ "c:\1\test.htm", TextToDisplay:="Test" End With End Sub "PPL" wrote: > Excel 2002 / 2003. > I'm trying to create a hyperlink in cell A19 such that the result opens in a > new window. I'm using > > Range("A19").Select > ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="c:\test.htm", > NewWindow:=True, AddHistory:=True > > I'm getting Runtime Error 1004: Application defined or Object defined error > > Anyone any idea where am I going wrong ??? > > TIA > > > > > > . >
From: PPL on 17 Mar 2010 22:49 Thanks Brian, That works well. However I need the file to open in a new window. I've tried appending NewWindow:=True to your Hyperlinks.Add method as follows: ActiveSheet.Range("A19").Select > With ActiveSheet > .Hyperlinks.Add Anchor:=Selection, Address:= _ > "c:\1\test.htm", TextToDisplay:="Test", NewWindow:="True" > End With > End Sub I'm getting Runtime Error 1004: Application defined or Object defined error. Is there any other way of achieving the same result please? Thanks again Phil "Brian" <Brian(a)discussions.microsoft.com> wrote in message news:2D58C537-D2BB-40D7-BE15-4F5CD9B07276(a)microsoft.com... > Try.... > > Sub Test2() > > ActiveSheet.Range("A19").Select > With ActiveSheet > .Hyperlinks.Add Anchor:=Selection, Address:= _ > "c:\1\test.htm", TextToDisplay:="Test" > End With > End Sub > > "PPL" wrote: > >> Excel 2002 / 2003. >> I'm trying to create a hyperlink in cell A19 such that the result opens >> in a >> new window. I'm using >> >> Range("A19").Select >> ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="c:\test.htm", >> NewWindow:=True, AddHistory:=True >> >> I'm getting Runtime Error 1004: Application defined or Object defined >> error >> >> Anyone any idea where am I going wrong ??? >> >> TIA >> >> >> >> >> >> . >> >
From: PPL on 17 Mar 2010 23:50 Thanks Dave, Maybe I need to look at the FollowHyperlink method. Thanks again for your response. Phil "Dave Peterson" <petersod(a)verizonXSPAM.net> wrote in message news:4BA174D5.49DA5BF2(a)verizonXSPAM.net... > When I look at VBA's help for the Add method for Hyperlinks, I see this: > > Add method as it applies to the Hyperlinks object. > > Adds a hyperlink to the specified range or shape. Returns a Hyperlink > object. > > expression.Add(Anchor, Address, SubAddress, ScreenTip, TextToDisplay) > expression Required. An expression that returns a Hyperlinks object. > > Anchor Required Object. The anchor for the hyperlink. Can be either a > Range > or Shape object. > > Address Required String. The address of the hyperlink. > > SubAddress Optional Variant. The subaddress of the hyperlink. > > ScreenTip Optional Variant. The screen tip to be displayed when the > mouse > pointer is paused over the hyperlink. > > TextToDisplay Optional Variant. The text to be displayed for the > hyperlink. > > > ====== > I don't see NewWindow or addhistory parms. > > I think you've gotten these parms confused with .FollowHyperlink's parms. > > > > PPL wrote: >> >> Excel 2002 / 2003. >> I'm trying to create a hyperlink in cell A19 such that the result opens >> in a >> new window. I'm using >> >> Range("A19").Select >> ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="c:\test.htm", >> NewWindow:=True, AddHistory:=True >> >> I'm getting Runtime Error 1004: Application defined or Object defined >> error >> >> Anyone any idea where am I going wrong ??? >> >> TIA > > -- > > Dave Peterson
|
Next
|
Last
Pages: 1 2 Prev: Filling right header/footer with barcode Next: Create a list of pre-named tabs |