View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dean J.[_2_] Dean J.[_2_] is offline
external usenet poster
 
Posts: 6
Default Sheets added by VBA invalidates digitally signed VBA project

Dick

That would definitely do the trick. I went ahead and put in a MSDN support
ticket, since I feel this is a bug (if it is they usually won't use 1 of your
incidents) Trusted and Signed macro code should be able to add/remove
sheets. I sent the sample workbook that reproduces the issue to the support
guy a few minutes ago. Thanks for your response. I'll post Microsoft's
response here as soon as I hear back.

-Dean

"Dick Kusleika" wrote:

Dean

Use a custom property in the user workbook. Have your add-in check for this
property using an Application_WorkbookOpen event and if it exists, add the
menu item. Then use the Application_BeforeClose (from the add-in) to delete
the menu when the workbook is closed. The add-in will be running all the
time, but it will only show it's menu in the proper context.

--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com

Dean J. wrote:
Thanks Dick,

My workbook has a custom menu I had at the top before the "Help" menu.
Wouldn't an add-in put this menu up there for *every* workbook
opened? I guess I could load/un-load the add-in every time the
workbook is opened/closed, but I've wondered if doing that so often
would corrupt the registry or something... since I don't know what MS
does when an add-in is loaded/un-loaded. I've been researching to
see if it's possible to associate an add-in with a workbook, not with
all of Excel, but can't find any info.

Thanks again,
Dean

"Dick Kusleika" wrote:

Dean

I've had that same problem but it wasn't related to adding or
removing sheets. Actually, I never did determine what the real
cause was, but it happend to a lot of similar workbooks at the same
time.

By putting your code in add-in, you lose some of the portability of
the workbook, i.e., you have to distribute two workbooks instead of
one. But you gain in that you elimate this problem. So that's the
trade off, and I decided, for me, to put the code in an add-in even
if it only related to one workbook.

--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com

Dean J. wrote:
version: Excel 2003 Pro.

Changing a VBA project invalidates the digital signature if it's
signed.
How can VBA code add/remove sheets without invalidating the
signature? There's another thread in this group ("Digital signature
being dropped") dated 1/6/2005 about the same problem, but with no
reply.

The only way that works is an Excel add-in. I don't know why that
doesn't invalidate the signature. I don't want to use an add-in
because my code is specific to this 1 particular workbook, not
*every* Excel workbook.

Keep in mind, to test this you have to try it on a computer that
doesn't have the signature's private key, since saving the workbook
on the computer with the private key simply re-signs the VBA project
when it becomes invalid.

Please help. Thanks.