Home » Developer & Programmer » Forms » excel hyperlink (Oracle forms 10.1.2.02, Windows XP)
excel hyperlink [message #570806] Fri, 16 November 2012 00:23 Go to next message
Akarsh
Messages: 16
Registered: November 2012
Location: India
Junior Member
Function HLink(rng As Range) As String
'extract URL from hyperlink
If rng(1).Hyperlinks.Count Then HLink = rng.Hyperlinks(1).Address
End Function

This VBA code perfectly runs on excel to get hyperlink Address.
How can i do it with OLE2 package?

[Updated on: Fri, 16 November 2012 23:32]

Report message to a moderator

Re: excel hyperlink [message #571782 is a reply to message #570806] Fri, 30 November 2012 05:57 Go to previous message
Akarsh
Messages: 16
Registered: November 2012
Location: India
Junior Member
i have tried the following code but i am not able to set hyperlink in excel..

Declare
application ole2.OBJ_TYPE;
workbook1 ole2.OBJ_TYPE;
workbooks1 ole2.OBJ_TYPE;
worksheet1 ole2.OBJ_TYPE;
worksheets1 ole2.OBJ_TYPE;
args1 ole2.List_Type;
file1 varchar2(300):='D:\final_new_backs_of_factory(Printout)_'||sysdate||'.xls';
cell ole2.obj_type;

begin

application := ole2.create_obj('excel.application');
ole2.set_property(application,'visible','true');
args1 := OLE2.Create_Arglist;
workbooks1 := OLE2.GET_OBJ_PROPERTY(application, 'Workbooks');
workbook1 := OLE2.INVOKE_OBJ(workbooks1,'Add');
worksheets1 := OLE2.GET_OBJ_PROPERTY(workbook1, 'sheets');
worksheet1 := OLE2.INVOKE_OBJ(worksheets1,'Add');
OLE2.SET_PROPERTY(worksheet1, 'Name', 'akarsh');
OLE2.DESTROY_ARGLIST(args1);

--ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= "Book%20Format%20A5%20size.xlsx", TextToDisplay:="RND"

args1 := ole2.create_arglist;
ole2.add_arg(args1,1);
ole2.add_arg(args1,1);
cell:=ole2.get_obj_property(worksheet1,'cells',args1);
ole2.set_property(cell,'value','rupal');
ole2.destroy_arglist(args1);

ole2.set_property(ole2.get_obj_property(cell,'font'),'Name','Cambria');
ole2.set_property(ole2.get_obj_property(cell,'font'),'size',11);
ole2.invoke(ole2.get_obj_property(worksheet1,'Hyperlinks'),'Add Anchor',cell);
ole2.invoke(ole2.get_obj_property(worksheet1,'Hyperlinks'),'Address','Book%20Format%20A5%20size.xlsx');
ole2.invoke(ole2.get_obj_property(worksheet1,'Hyperlinks'),'TexttoDisplay','Click');

--ole2.invoke(cell,'Hyperlinks.Add Anchor',args1);
--ole2.invoke(cell,'Hyperlinks.Address','Book%20Format%20A5%20size.xlsx');
--ole2.invoke(cell,'Hyperlinks.TextToDisplay','RND');

ole2.release_obj(cell);
OLE2.RELEASE_OBJ(worksheet1);
OLE2.RELEASE_OBJ(worksheets1);
OLE2.RELEASE_OBJ(workbook1);
OLE2.RELEASE_OBJ(workbooks1);
OLE2.INVOKE(application,'QUIT');
OLE2.RELEASE_OBJ(application);
end;

Anyone please help m to solve this...
Previous Topic: Logo & Home Page Picture Quality
Next Topic: Clear Block Message in oracle forms.
Goto Forum:
  


Current Time: Sat Apr 19 00:47:51 CDT 2014

Total time taken to generate the page: 0.08917 seconds