Alaska Software Inc. - How to let MS be smart for you
Username: Password:
AuthorTopic: How to let MS be smart for you
Bruce AndersonHow to let MS be smart for you
on Wed, 08 Apr 2009 14:15:59 -0500
More than once, it has been stated here that the best way to learn the 
XBase++ code for working with ActiveX objects is to record a macro with your 
desired application, study it, and convert it to XBase++.  I think whenever 
you can eliminate a middle man, you save money and time. I eliminate the 
"recode it in Xbase" steps.

I have an application which gathers lots of financial data so we can 
distribute beautiful and complicated reports.  I do the backend processing 
and store the summary results in several simple "scratchpad" xls files.  The 
fully formatted master template file receives updated results via links to 
cells in the scratchpads.  The template is then saved as a user file. 
Finally, the new user file is opened, the links are broken using a macro 
which was present in the template file, and the file saved, ready for 
downloading.

Here is the complicated XBase++ code used to build the multi-worksheet with 
tens of thousands of cells report...

LOCAL  cCmd := cUserFileCoreName + "!X_Link"         "X_Link" is the name 
of the Excel macro which breaks the cell links
                 cUserFileCoreName identifys which workbook has the macro, 
ex: "MyBook!X_Link"

 open the scratchpad xls files so they are available to update the master 
template
...
oBook := oExcel:Workbooks:Open( cTemplateFile, 3 )   "3" means auto update 
from links on open
oBook:saveas( cNewUserFile )
oBook := oExcel:Workbooks:Open( cNewUserFile, 2 )    "2" means no update 
from links on open
oExcel:run( cCmd )    have Excel run the macro and kill the links
oBook:save()
oExcel:Quit()

The internet is full of macro examples to do anything you desire with Excel 
or MS Word.  Just drop them in and tell them to run.  Best part of the 
deal - my client does the formatting of the template file, fonts, colors, 
etc. to make it look exactly like they want it.  Read that as "I do not code 
any of it".

Bruce Anderson
Graphical Database Programs
Houston
Osvaldo Ramirez Re: How to let MS be smart for you
on Wed, 08 Apr 2009 15:48:29 -0600
Hello Bruce Anderson

if dont mind, could you put a simple example ?

I will appreciate your help

Best Regards
Osvaldo Ramirez

wrote:
> More than once, it has been stated here that the best way to learn the 
> XBase++ code for working with ActiveX objects is to record a macro with 
> your desired application, study it, and convert it to XBase++.  I think 
> whenever you can eliminate a middle man, you save money and time. I 
> eliminate the "recode it in Xbase" steps.
> 
> I have an application which gathers lots of financial data so we can 
> distribute beautiful and complicated reports.  I do the backend 
> processing and store the summary results in several simple "scratchpad" 
> xls files.  The fully formatted master template file receives updated 
> results via links to cells in the scratchpads.  The template is then 
> saved as a user file. Finally, the new user file is opened, the links 
> are broken using a macro which was present in the template file, and the 
> file saved, ready for downloading.
> 
> Here is the complicated XBase++ code used to build the multi-worksheet 
> with tens of thousands of cells report...
> 
> LOCAL  cCmd := cUserFileCoreName + "!X_Link"         "X_Link" is the 
> name of the Excel macro which breaks the cell links
>                 cUserFileCoreName identifys which workbook has the 
> macro, ex: "MyBook!X_Link"
> 
>  open the scratchpad xls files so they are available to update the 
> master template
> ...
> oBook := oExcel:Workbooks:Open( cTemplateFile, 3 )   "3" means auto 
> update from links on open
> oBook:saveas( cNewUserFile )
> oBook := oExcel:Workbooks:Open( cNewUserFile, 2 )    "2" means no 
> update from links on open
> oExcel:run( cCmd )    have Excel run the macro and kill the links
> oBook:save()
> oExcel:Quit()
> 
> The internet is full of macro examples to do anything you desire with 
> Excel or MS Word.  Just drop them in and tell them to run.  Best part of 
> the deal - my client does the formatting of the template file, fonts, 
> colors, etc. to make it look exactly like they want it.  Read that as "I 
> do not code any of it".
> 
> Bruce Anderson
> Graphical Database Programs
> Houston
Thomas Braun
Re: How to let MS be smart for you
on Thu, 09 Apr 2009 09:29:31 +0200
Bruce Anderson wrote:

> Read that as "I do not code any of it".

But you can't charge the customer for what you don't write 


Thomas
Rodd Graham Re: How to let MS be smart for you
on Thu, 09 Apr 2009 10:22:30 +0000
Hello Thomas,

>> Read that as "I do not code any of it".
>> 
> But you can't charge the customer for what you don't write 

Not entirely true.  Knowing how to get from A to B is billable in and of 
itself regardless of the method used.  This is typically reflected in a higher 
hourly fee when time and materials is used and retainage fees when it is 
not.  It is much better to reward results than effort.  

Regards,

Rodd Graham, Consultant
Graham Automation Systems, LLC
Donald R. KeatingRe: How to let MS be smart for you
on Thu, 09 Apr 2009 09:09:33 -0400
Hi Y'all,

I'm reminded of the old story about the patient complaining to the surgeon
for cost of his brain surgery.

Patient thought cost for such a small incision was was out of line (too
much) and complained bitterly to the surgeon.

Surgeon informed him he didn't pay fo size of incision but, rather for
knowing where to cut.

    >don<

On Thu, 9 Apr 2009 10:22:30 +0000 (UTC), Rodd Graham wrote:

> Hello Thomas,
> 
> >> Read that as "I do not code any of it".
> >> 
> > But you can't charge the customer for what you don't write 
> 
> Not entirely true.  Knowing how to get from A to B is billable in and of 
> itself regardless of the method used.  This is typically reflected in a
higher 
> hourly fee when time and materials is used and retainage fees when it is 
> not.  It is much better to reward results than effort.  
> 
> Regards,
> 
> Rodd Graham, Consultant
> Graham Automation Systems, LLC
Thomas Braun
Re: How to let MS be smart for you
on Thu, 09 Apr 2009 16:37:11 +0200
Donald R. Keating wrote:

> Surgeon informed him he didn't pay fo size of incision but, rather for
> knowing where to cut.

LOL - very good story!

thomas
Rodd Graham Re: How to let MS be smart for you
on Fri, 10 Apr 2009 09:11:08 +0000
Hello Bruce,

> More than once, it has been stated here that the best way to learn the
> XBase++ code for working with ActiveX objects is to record a macro
> with your desired application, study it, and convert it to XBase++.  I
> think whenever you can eliminate a middle man, you save money and
> time. I eliminate the "recode it in Xbase" steps.
> 

FWIW, the same principle can be applied to the Windows Scripting Host which 
is also available via COM.  By mastering the use of the scripting host from 
Xbase++, you can take advantage of all of the VBScript/JavaScript you find 
on the web without recoding it into Xbase++.

Regards,

Rodd Graham, Consultant
Graham Automation Systems, LLC
Bruce AndersonRe: How to let MS be smart for you
on Fri, 10 Apr 2009 09:51:13 -0500
So, the ability to us XBase++ to instanciate a WScript object essentially 
turns XBase++ into a wrapper procedure for VB.  The scales have fallen from 
my eyes...
Rodd Graham Re: How to let MS be smart for you
on Fri, 10 Apr 2009 20:54:25 +0000
Hello Bruce,

> So, the ability to us XBase++ to instanciate a WScript object
> essentially turns XBase++ into a wrapper procedure for VB.  The scales
> have fallen from my eyes...
> 

Yes, but VBA.  This can be handy for those COM objects (not visual controls) 
that have complexity/compatibility issues with Xbase++.  VBA is generally 
good at implementing full COM compatibility.

Regards,

Rodd Graham, Consultant
Graham Automation Systems, LLC
Bruce AndersonRe: How to let MS be smart for you
on Sat, 11 Apr 2009 09:36:26 -0500
I managed to generate two typos in two sentences.  I have sausages for 
fingers these days.