Focal Point
Running Macros on click of Hyperlink in EXCEL

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1801054812

March 16, 2007, 06:31 AM
Code Digger
Running Macros on click of Hyperlink in EXCEL
Hi,

I have a report with Excel output where I wish to have a "PRINT" link in header. When I click on this Link a Macro should run which overwrites the default Printer Properties with the ones specified in this Macro.

Is this possible? And how this can be achieved using WF code.

Regards
CD
March 16, 2007, 09:43 AM
jgelona
If you are in Excel 2002 or higher. Create a workbook with at least 2 sheets. Save it as an .mht. Put your macro in the workbook. Copy to .mht file to the Reporting Server (I put them in the baseapp folder). Run your fex with "ON TABLE HOLD FORMAT EXL2K TEMPLATE 'templatename' SHEETNUMBER 1".

When the report displays, the user can run the macro using a hotkey (i.e. Alt-P) or click on your link in the heading. Sorry, but I have not tried putting a Run Macro Command a heading, but I bet it can be done.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
March 20, 2007, 04:07 AM
Code Digger
Thx for the reply,

But my doubt is how will the EXCEL come to know it has to run the Macro on the click of that Link. Hence what should be the coding for that link (some FOCEXEC etc) so that the Link gets associated with the Macro code??
March 20, 2007, 04:28 AM
Tony A
CD,

I would be inclined to place the button in the web archive in readinesss for the data to be loaded. Unless the fact is that you want the drill down links to be the "buttons"?
If the case is the latter (as I suspect) then I am not sure that you can do it as WF (to my knowledge) cannot pass VBA code into the Excel worksheet.

What is that you are attempting to get the macro to achieve? Parse the data into ranges etc.?

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
March 20, 2007, 08:35 AM
<JG>
The easiest way to do what you want is to insert an image and assign a macro to the image.
For the method, a lot depends on what release of WebFocus you are running.
71+ use a template,for previous releases look at my article on macros pre 71.

In excel one of the options for an image (or word art) if you right click on it, is to assign a macro.
If it's a single page that you want to print then just use my example for assigning the range and add
the print commands.
If it's multiple pages then you need to play around a little.

Using word art to create the macro link is probabley the best solution as an image does not need to be available
to the excel document.

This message has been edited. Last edited by: <JG>,
March 20, 2007, 11:03 AM
Glenda
JG,

Do you have a link to this article?


Glenda

In FOCUS Since 1990
Production 8.2 Windows
March 20, 2007, 11:17 AM
<JG>
on the Focus on developers page.

http://www.informationbuilders.com/support/developers/macros.html