Signing VBA code within an Excel spreadsheet from VBA

M

Martin Waller

Hello,

I have a system where I dynamically create XLS files on the fly by
automating Excel 2003. The XLS files contain VBA code that is injected,
again via automation, and I'd like to know if it is possible to dynamically
sign the code too - again on the fly and not by the dialogs.

Any help would be much appreciated...

Martin
 
B

Bernie Deitrick

Martin,

I believe that you need to use a template file that is already signed as the
basis of your files created on the fly.

HTH,
Bernie
MS Excel MVP
 
J

Jeff Jones

Martin,

I'm sorry to bother you but it looks as if you've already got a
solution to something I'm trying to do in MS Excel. I saw the
following message on the microsoft.public.excel.programming list.


Using MS Access, I have some code that runs a query and then outputs
the rows in the result to am MS Excel spreadsheet. I then push a
button in MS Excel to launch a macro in my personal.xls file to
reformat the data. I add filters via the macro to the columns to
enable us to easily look at subsets of the data. I have a little
function that I'd like to add to the newly created spreadsheet so that
I can produce some totals based on visible cells. Here's the
function.

=Sum_Visible_Cells(A1:A5) ' where A1:A5 is the range that you want
to sum and is placed in a cell in the spreadsheet..


Function Sum_Visible_Cells(Cells_To_Sum As Object)
Application.Volatile
For Each cell In Cells_To_Sum
If cell.Rows.Hidden = False Then
If cell.Columns.Hidden = False Then
total = total + cell.Value
End If
End If
Next
Sum_Visible_Cells = total
End Function

Based on your question, it looks as if you have figured out how to
programmatically add code to a spreadsheet. if this is true, would
you object to sharing how you do it?

Thank you.

Best Regards,
Jeff Jones
EDS
5109 Deer Lake Trail
Wake Forest, NC 27587

(e-mail address removed) Tue, 31 Aug 2004 13:56:08 +0100, "Martin
 
B

Bernie Deitrick

Jeff,

If you are filtering your values, then simply use

=SUBTOTAL(9, A1:A5)

which will give the sum of all the visible (not hidden by the filter) cells.

HTH,
Bernie
MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top