Wierd problem with VBA/Excel
Wierd problem with VBA/Excel
(OP)
I've got a spreadsheet with some macros to automate various tasks. It does all the things I intend for it to do... but only on my computer. When I open it from another user's computer, none of the built-in VBA functions seem to work. I can't find any missing library references.
Btw, when I say "none," I mean it. For example, the Mid() function doesn't work unless I call it as VBA.strings.Mid(), the "Like" statement doesn't seem to work, etc.
Btw, when I say "none," I mean it. For example, the Mid() function doesn't work unless I call it as VBA.strings.Mid(), the "Like" statement doesn't seem to work, etc.





RE: Wierd problem with VBA/Excel
if I create a new spreadsheet on the other user's machine, and re-key my subroutines (verbatim) into it, they run just fine. If I switch windows back to my other sheet, they still don't work. Switch back, they work again.
RE: Wierd problem with VBA/Excel
Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376 before posting
Steam Engine enthusiasts: www.essexsteam.co.uk
RE: Wierd problem with VBA/Excel
RE: Wierd problem with VBA/Excel
The vba.[function] seems to be a 70% fix - there are some things that still don't seem to work, like
Selection.ShapeRange.ScaleWidth 0.9, msoFalse, msoScaleFromBottomRight
in which neither msoFalse nor msoScaleFromBottomRight are recognized. So far my workaround is to use vbFalse and omit the msoScaleFromBottomRight. This means that I need to reposition the pic later, but that is do-able.
RE: Wierd problem with VBA/Excel
In the VBA Editor look at Tools->References and then ensure that VBA for Applications is checked as well as is the Excel <version> Object Library. Depending on other things in your code, you may require other references as well.
Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
RE: Wierd problem with VBA/Excel
As for the constants (msoFalse and msoScaleFromBottomRight), you can just use the integer number instead. If you need to find the number, just go to a machine where the function works and run a quick MsgBox msoScaleFromBottomRight.
You do realize that those constants are in the Office library rather than the VBA library, right?
RE: Wierd problem with VBA/Excel
Everything is ironed out now... but it still irks me that the stupid thing didn't work the first time. The most bizarre example of the problem was when I recorded a macro using the recorder, and then couldn't run it moments later on the same machine (for lack of the right library).