Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Running a macro using web focus code (Excel 2k )
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] Running a macro using web focus code (Excel 2k )
 Login/Join
 
Gold member
posted
Is there any way of running a macro through webfocus code when generating reports in excel format?
I have created a .mht file which includes a statement to directly print the report output: "ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True" and this .mht file is referred to in my ON TABLE PCHOLD statement. But the result is: when i run my report, i do get the output in excel format and then when i go to Tools->Macro->Macros and then run the macro(the macro does appear), the output is getting printed. Is there any way such that when my excel output gets generated, at the same time, the macro is run ?

This message has been edited. Last edited by: Kerry,
 
Posts: 78 | Registered: December 11, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
CD,

You will need to identify a suitable event to use. Not sure what it might be. Have you tried an Excel forum?



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 
 
Posts: 5661 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Gold member
posted Hide Post
CD,

Are you wanting your .mht to auto-run the macro when the report opens in Excel so that it brings up the print dialogue window to print the spreadsheet?

Dennis


Local: AppStudio 8.2.03 - Win7 - Tomcat Server: WebFOCUS 8.2.03 - Windows 2008 R2 Enterprise on VMWare 2 CPU, 3.2GHz, 4GB of RAM Output Formats: HTML, Excel, PDF, PPT, Active Reports
 
Posts: 39 | Location: Denver, CO | Registered: March 16, 2005Reply With QuoteReport This Post
Gold member
posted Hide Post
Yes, this is something similar to what I want. The .mht should auto-run the macro when the report opens in Excel so that it automatically gives the print out and doesnt even bring up the print dialogue window.
 
Posts: 78 | Registered: December 11, 2005Reply With QuoteReport This Post
Master
posted Hide Post
Actually I am doing something like this right now. I saved a .mht in baseapp on the Reporting Server. I wrote a macro to do some formatting, turning filters on, freeze panes, etc. Just name the macro Auto_Open. Seems to work fine.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 950 | Location: Oklahoma City | Registered: October 27, 2006Reply With QuoteReport This Post
Member
posted Hide Post
 
Posts: 22 | Registered: October 13, 2006Reply With QuoteReport This Post
Virtuoso
posted Hide Post
running a macro in excel just to get the report printed is a strange way to work.
I would give the report directly into PDF, no user can influence the layout anymore.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Reply With QuoteReport This Post
Expert
posted Hide Post
Is there a setting within Excel which automatically sets the column width to a minimum based on the contents, similar to double-clicking the column dividers? Something other then an macro which is close to automatic but not directly automatic unless we do some work and implement that on the users machines. Having the users change a setting within Excel is acceptable. OK, maybe a macro which we can, through WebFOCUS PCHOLD, automatically execute.
 
Posts: 3066 | Location: Middle Tennessee [8204M Gen48 in Test&Prod] | Registered: February 23, 2005Reply With QuoteReport This Post
Virtuoso
posted Hide Post
This basic Excel VBA routine selects all cells in the worksheet and "commands" them to auto-fit their contents:

Sub ColumnWidth()
' Keyboard Shortcut: Ctrl+Shift+W
    Cells.Select
    Selection.Columns.AutoFit
End Sub


You could make it part of a file that can be later used as a template, or attempt to use the technique outlined in ibidevelop's reference above.

The routine can of course be improved to capture the current Worksheet and Cell/Range selected before any changes are made, and re-select them after the columns have been adjusted.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Reply With QuoteReport This Post
Virtuoso
posted Hide Post
The "manual" steps to make that happen in Excel are:

1. Select all cells (by clicking the empty area where row and column labels intersect)
2. Choose the following options from the menu: Format -> Column -> Autofit Selection

That's what I and some business users at my site do. As we are still using WebFOCUS 5.3.4 the use of Excel Templates is not a feasible option at the time.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Running a macro using web focus code (Excel 2k )

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.