Does Workbook open event work in compiled workbook?

Status
Not open for further replies.
Frederick,

At this juncture I’d be starting the process of elimination but first a couple of questions:
  1. What version and build number of Windows are you running?
  2. What version and build number of Excel are you running?
  3. What version of XLS Padlock are you running?
  4. Is this an app that you are wanting to distribute to others?
Process of elimination:
Move/copy your working un-compiled workbook to your desktop
Move/copy your $Sign.ico file to your desktop
In your code point the location of your icon file to the desktop .ico file
Open the workbook from the desktop, modify code, save with SaveAs, then Save again
Compile the workbook with the default XLS Padlock compiler settings
Run the .exe file from the desktop
What results did you get?

Suggestions:
Stay away from read/writes to/from protected folders (i.e.,Program Files, Temp, Windows, etc.)
If you wish to distribute your app to others and absolutely need a folder where all user profiles can access,
use the “C:\Users\Public” folder.

In Excel open the VBA editor and go to Tools>Options>General and check the options for (make note of your setting before modifying):

Error Trapping: click on the "Break on Unhandled Errors"
Compile: Check both the “Compile on Demand” and “Background Compile”

When using API calls in Excel you have to be concerned that at any time a Microsoft Windows Update can halt/disable/abandon the execution of those API calls because of the lack of support for the older API programming language. API codes have only a limited life time. With API calls, you must always count on the fact that your code no longer works after an Windows update.

I’ve compiled the code in this discussion using Excel 2013, Excel 2016 and have tested it on Win 7 and Win 10 and it is working on both environments and Excel versions.

Let me know.
 
My troubleshooting Im trying to establish if all the code gets read after the exe compile support. I have established your workbook open events work correctly.If I run the amended provided code in the xlsm file in the workbook open routine the msgbox fire. If I run the compiled exe file the msgbox does not fire…Something is going wrong on the exe compile for the function not to change the icon. Please note this is the workbook icon I am talking about not the exe icon. My app have a userform…if I click one button on my userform it open the workbook -if the workbook is open thats the icon file Im changing (changing the excel icon to my app icon). As I have mentioned it works flawlessly in xlsm file but not not after the exe compile
 
Last edited:
FTSC-PB said:
At this juncture I’d be starting the process of elimination but first a couple of questions:

What version and build number of Windows are you running?
What version and build number of Excel are you running?
What version of XLS Padlock are you running?
Is this an app that you are wanting to distribute to others?

Process of elimination:

Move/copy your working un-compiled workbook to your desktop

Move/copy your $Sign.ico file to your desktop

In your code point the location of your icon file to the desktop .ico file

Open the workbook from the desktop, modify code, save with SaveAs, then Save again

Compile the workbook with the default XLS Padlock compiler settings

Run the .exe file from the desktop

What results did you get?

Suggestions:

Stay away from read/writes to/from protected folders (i.e.,Program Files, Temp, Windows, etc.)

If you wish to distribute your app to others and absolutely need a folder where all user profiles can access,

use the “C:\Users\Public” folder.

In Excel open the VBA editor and go to Tools>Options>General and check the options for (make note of your setting before modifying):

Error Trapping: click on the “Break on Unhandled Errors”

Compile: Check both the “Compile on Demand” and “Background Compile”

When using API calls in Excel you have to be concerned that at any time a Microsoft Windows Update can halt/disable/abandon the execution of those API calls because of the lack of support for the older API programming language. API codes have only a limited life time. With API calls, you must always count on the fact that your code no longer works after an Windows update.

I’ve compiled the code in this discussion using Excel 2013, Excel 2016 and have tested it on Win 7 and Win 10 and it is working on both environments and Excel versions.

Let me know.
Hi FTSC-PB

Thank you for your response.Here are the answer to your questions

1Windows 7 Ultimate Service pack 1
2Microsoft Office 2007 Service pack 3
3Xlspadlock Version 3 (Your latest)
4Yes the app will be distrubited to other people correct

I will try that but you are missing one thing that I have mentioned which is

All the functions and even my last test to establish if the msgbox fire work on the xlsm file which is CLEARLY telling us the problem is the conversion to the COMPILED CODE.In my last test the msgbox doesnt fire on the compiled file but its working with the same code in the xlsm file…thus I am am mentioning that your VBA compiler are not happy with this code**… MessageA Application.hWnd, WM_SETICON, ICON_SMALL, hwndIcon

I wi
ll try your suggestion but I will GUARENTEE YOU the problem is on the way the code are compiled your VBACOMPILER dont understand that line thus this function not executing. An easier test is if you can take my macro and compile it yourself you will see exactly what I am saying -and dont forget the XLSM file works 100% the problem is with the compiled code your VBACOMPILER does NOT understand that line it will never work until your VBACOMPILER can understand the function

On your protected area I have copied this exact same folder to my C:\TEMP directory where I have full access - I am running the PC as administrator. Same thing the xlsm works fine and change the icon and the msgbox fire on the workbook open event. Your compiled exe FAIL and the Msgbox doesnt fire which is telling me it does not even get there

Thanks for your help though -tough one this as somewhere something is not right on the compiling of the exe

Golfer65
 
Last edited:
Frederick,

For clarification, I (FTSC-PB) do not work or an a employee of GDG Software (XLS Padlock). I, like you, have purchased XLS Padlock, and am a user of the software.As I re-read through this discussion I still don’t see your entire API code and notice that you are using a slightly different API calls than the example I’ve discussed here?
 
FTSC-PB said:
Frederick,

For clarification, I (FTSC-PB) do not work or an a employee of GDG Software (XLS Padlock). I, like you, have purchased XLS Padlock, and am a user of the software.As I re-read through this discussion I still don’t see your entire API code and notice that you are using a slightly different API calls than the example I’ve discussed here?
Ok thank you for the Clarification FTSC-PB…sorry I almost thought you are an employee of GDG…FTSC-PB Look I am trying my best to try and figure this out. What I have seen there are allot of people Phuong JohnBrennan that their array codes dont work on the compiler etc…thus that macro is a straight forward function call to change the icon. I love the software its just the learning curve on it is a bit tough as lots of things need extra work to get it back to your original macro… 🙂 Thank you for all your valuable help FTSC-PB -much appreciated
 
Last edited:
Frederick,

Let give you some insight. We have been developing Excel Apps’ since its inception on the Macintosh. Yes the Mac. Excel for Mac was the first GUI version of Excel and it wasn’t until 1995 that MS released a very stable version of Excel (Excel 4.0) to run on the evolving Windows 95 platform. If you wish to release your app across your company or to make it commercially available you will need to have at least these test platforms that include:

Excel 2007, 2010, 2013, 2016 (without the compiler)
Computers running Windows 7, 8.x, 10 (with most of the Windows build versions)
Computers with low res and high res monitors, portrait and landscape orientations
Tablet computers

I can personally tell you that as Microsoft has upgraded Excel from 2007 to 2016 there are many, many, many changes in the UI, code references, controls, and things that ran effortlessly on 2007 no longer run on 2010, 2013, 2016, and things that ran effortlessly on 2010 no longer work on 2013 and 2016 (for example, charting and chart types has been replaced) and now with Win 10, it seems that with every update for Windows 10, Excel 2016 (which is supposed to be Excel’s tablet friendly version) seems to have repercussions with every update. If you get on the MS developer sites & blogs, there are millions of questions but few answers as to why things that used to work and now they don’t work and, this does not include Excel 2016 running on tablets (that is where we are marketing our Excel apps) and having to deal with all of the finger gestures and orientation issues that Excel 2016 inherently does not trigger any events. Not knowing your target audience for your app, I would suggest take a step back, see what features in your app that are forward available in all versions of Excel, and try to find common ground on the features you have to delete or re-think, and yes there will be compromises when adapting your app to the compiler.

Let me know.
 
Still unclear: where are you placing your icon change code? Is it in the VBE or in the XLS Padlock’s VBA compiler?
 
FTSC-PB said:
I can personally tell you that as Microsoft has upgraded Excel from 2007 to 2016 there are many, many, many changes in the UI, code references, controls, and things that ran effortlessly on 2007 no longer run on 2010, 2013, 2016, and things that ran effortlessly on 2010 no longer work on 2013 and 2016 (for example, charting and chart types has been replaced) and now with Win 10, it seems that with every update for Windows 10, Excel 2016 (which is supposed to be Excel’s tablet friendly version) seems to have repercussions with every update.
We can confirm that. And Microsoft has a monthly release scheme for Office 365!
That’s also why releasing XLS Padlock takes a lot of time, because we have to perform testing with all Excel versions (and bitness).
Anyway, the incoming release of XLS Padlock will offer better compatibility with the new Windows Falls Creator Update.

Note that with the introduction of 64-bit Office, some Windows API imported into Excel may not work without updating them. Excel 2007 is only 32-bit but more recent versions are both 32-bit and 64-bit.
 
gdgsupport said:
Still unclear: where are you placing your icon change code? Is it in the VBE or in the XLS Padlock’s VBA compiler?
Support i have only put the macro in the compiler to see if your compiler understand it -In your VBA compiler.If the compiled code are understood there will be no errors…in my change icon macro there is 1 error that the compiler dont understand
 
Macros that call Windows API shouldn’t be entirely placed in the VBA compiler. Especially the VBA icon modification code isn’t really something you want to hide by compiling it into bytecode.
 
You have a valid point here Support I understand what you say…but if your compiler understand the code there is no errors…We are compiling the exe but the function does not work…so where is the problem ? Tough one I know trust me its a problem for me to get my app compatible with xlspadlock code -api’s are tricky very valid point you made!
 
Status
Not open for further replies.
Back
Top