Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xls hyperlink to another sheet (vfp6)

Status
Not open for further replies.

omr1119

Programmer
Oct 7, 2003
34
0
0
PH
Hi to all Tip Master's,

How to Automate programmatically Hyperlink from sheet1 to sheet2

i have existing programs :

With oExcel
.sheets("Sheet2").Select
.sheets.Add.Name = Variable1
.Sheets("Sheet1").select
Endwith

After this Procedure i need to hyperlink
let say
.Sheets("Sheet1").select
.Range("A5").select

to ..... Sheet2 or Variable1


Thanksalot,
[peace]
 
Check out the Add method of the Hyperlinks object.

BTW, you virtually never need to call the Select method when automating Excel (or Word, for that matter). You can work directly with the objects in question. So for example, you can do:

oRange = oExcel.ActiveWorkbook.Sheets("Sheet1").Range("A5")

Then you can work with oRange as much as you need.

Called Select slows things down because Excel has to move the highlight.

Tamar
 
hi Tamar,

i tried using macro programming using excel.
then copy to my existing program.

see sample below

ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= "Sheet2!A1", TextToDisplay:="12345"

can you help me the right syntax when running in VFP6.


thanks,
[peace]
 
Basic rules for translation:

1) Parameters must be enclosed in parens.
2) VFP doesn't use named parameters; you must provide only the values and put them in the right order.
3) If the parameters use any constants, you need to look up their values and either use the specific value or #DEFINE your own corresponding constants.

For your example, you'll need to set a variable (I'll call it oRange) to the anchor you want. Then, probably it'll be:

oExcel.ActiveSheet.Hyperlinks.Add(oRange, "", "Sheet2!A1", "12345")

But you'll need to look up the method and check the order of parameters.

Tamar
 
Hi Tamar,

Thank u for ur time and tip's i will try ur suggestion....

thanks a lot,
[peace]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top