Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Cannot .Show a form that was imported?

  Asked By: Lucas    Date: Dec 04    Category: MS Office    Views: 732
  

I am having an issue with a form that I have not experienced before. I
imported a form with the name frmBook into a user's Personal.xls. It
was a new version of an existing form, which I removed right before
importing this new version.

Problem is, the statement frmBook.Show produces the error #53. I have
done this exact same process on this exact same terminal before and
not had this problem.

I tried renaming the form to frmBook1 and running frmBook1.Show to no
avail. The new version of the form came from temp workbook, where i
did some improvement on the functionality of the form. What I did was
export the revised version onto the users desktop, then imported it
into their personal.xls file.

Does anyone have a clue as to why this would be occurring?

Share: 

 

9 Answers Found

 
Answer #1    Answered By: Pam Harrison     Answered On: Dec 04

Do you happen to have two workbooks open?
What about the workbook that IS open?
Does it have macros in it?
try opening a NEW workbook (only one) and see if it works.
I'm not sure what error 53 is, (can't look it up right now)
but I'm guessing there is a conflict with the form located
in the Personal.xls file. for that matter, ANY form located
in one workbook (like Personal.xls) being "called" from another
workbook is "messy"..
In order for the name to be found, the settings in excel must
ALLOW the application to look in workbooks other than the current one.

By default, unless told otherwise, Excel "assumes" Activeworkbook....
so.. it may be the the user's settings (security?) may be
disabling the ability to automatically search workbooks not "current".

Have you "loaded" the userform?

I tried this in Excel2007 and could not load or show the userform.
I'll have to investigate further to figure out how to load a form not in the
current workbook.

 
Answer #2    Answered By: Shannon Hughes     Answered On: Dec 04

I seem to remember a problem somewhat like this in the dim dark past. I
vaguely recall that I needed to put the code that accessed the form into the
workbook that contains the form. In my case, it would have been an XLA
macros workbook, but it could be similar.

If nothing else, it'd be good programming practice to put the code with the
form.

On the other hand, my memory is now trying to tell me that I couldn't put
the form in the XLA file at all, and needed to put it (plus probably its
activation code) into the main workbook, although the main code was in the
XLA file.

No definite information here, sorry. It was years ago, and I don't have the
workbooks now, I don't think. Just a couple more thoughts to consider.

 
Answer #3    Answered By: Clinton Edwards     Answered On: Dec 04

I am sorry, I should have been more descriptive in my post. I am
getting #53 "File Not Found" when I run frmBook.Show. I even tried it
with NO workbooks open, other than the personal.xls workbook, which is
where the form is stored, using the immediate pane.

I am thinking it has to be something on that particular pc though,
because i have this very same setup successfully running on several
other computers in my department.

As I said, I swapped out a prior version for the new one; I normally
export the old version to the user's PC, in case something weird like
this happens. So when this did happen, I was able to remove and delete
the newer version, re-import the older version that I stored on the
users pc, and it worked just fine.

I thought maybe something happened when I exported the new version out
of the test workbook I built it in, so I tried grabbing another
instance of it from another pc where it is working just fine, but I
get the same message when I import that instance of the form as well.

It seems just unable to 'see' this updated version on this one pc? I
suppose I could just copy and paste all the new code tied to the new
form into the old one, and make the form control modifications by
hand, but this seemed so strange. Whenever stuff like this happens, I
have to ask myself, 'is there something here that I am not aware I
should be doing?'

My code does live in the form, as was suggested, what doesn't is the
'show the form' code. This is in a regular module in the personal.xls
workbook, and is tied to a button on the users toolbar...

The personal.xls file does have several standard modules in it, but
this form is the only form on the pc.

Hmmm. I did not 'Load' the form. My open form code is just the .Show
line. Should I always load the form first? I have not been doing this
if so (but i can still bring up the form on all the other pc's)...

 
Answer #4    Answered By: Adelaide Fischer     Answered On: Dec 04

Where are you calling the code from? If you call it from a different
workbook, you'll need to qualify the reference.

 
Answer #5    Answered By: Blake Smith     Answered On: Dec 04

I sure can't help you more except to say that error #53 is supposed
to mean..."File not found".

 
Answer #6    Answered By: Ryder Anderson     Answered On: Dec 04

if you consider THIS a "novella", then
my posts must be considered ENCYCLOPEDIAS !!!

Your thought processes seem to be going in the
right track for debugging.
You have to remove the "variables"... the things
that make one case different from another.

Since you're importing and exporting the userform,
and one works while the other does not, then
the difference (or "variable") is in the userform.

The difficult part here is that Microsoft MAY be
giving you a "default" error message.
The problem could actually be in the code itself.
Like, did your UPDATE include some functionality that
requires excel to have another add-in that is not
included on THIS user's machine? In which case,
the actual error is that it couldn't resolve something,
but didn't know how to say it, so it just says
"file not found"... it's not the USERFORM that's not
found, but the ADD-IN (or resource, or...)

Something to try...
Import the userform into the workbook instead of Personal.xls.
See if it works from there...

==========================================

Now... a different, yet troubling side-comment.
If you want to try something a little different..
You indicated that in order to "distribute" your changes, you
have to export and import the userform into the Personal.xls file.

Is this because the userform isn't tied to a specific "application"/excel file?
In other words, the userform isn't using data from a file that has to be open
to work?

I have an excel file that has 10 userforms and 15 modules.
The file is used to retrieve and rebuild documents from an Oracle database.
There's over 30,000 lines of code. I'm continuously "improving" the code.
Ok... I'm fixing it... When I'm ready to "publish" the changes, I export the
modules and forms to a shared folder. When the user next opens the application,
I use the Workbook_Open event to load all forms and modules from the shared
folder,
so they always have the most recent version.
When the document is "published", I didn't want to include the forms and
modules,
so I use the BeforeSave event to delete all modules and userforms.

so you see, I never have to worry about visiting 180 workstations and making
sure
they all have the most recent "update"...

The ONLY concern I currently have is that I've hard-coded a password into the
workbook_open event so that I restrict access to the VBA code.
If the user is VERY quick, he can open the workbook and hit the "escape" key
and interrupt the imports before they finish and reset the protection.
If they do that, then they COULD read the VBA code and get my password.
I believe it's possible to disable the 'escape' key functionality, but I haven't
researched it.

If you want some sample code for doing something like this, let me know...

now, you still think you're a "novella" writer??? ;-)

 
Answer #7    Answered By: Angelica Ramos     Answered On: Dec 04

I know I can always get help here!!

Paul, ok my post does not seem so long anymore :O). You were
correct, it was in fact the new form that was causing the problem. I
can't believe I did not figure it out right away. The error
was 'File not found'. That would have nothing to do with the form
itself if it was being called from the same workbook - and anyway, a
form is not a file.

I added the capability to 'lock' options on the form, this is done
by writing any options checked (via checkboxes)to a txt file when
the "lock" button is pressed; This same file is accessed as part of
the form Initialization event and those checkboxes that are found in
the record are checked on the form's opening.

Yeah, guess who forgot to create the text file on the user's pc??
That's why I was getting the file not found.

I am embarrassed I needed to post to figure this out. *sigh*

=========================================
And, yes Paul, if you have sample code that I can take a look at so
that I can see how you are set up, that would be great. I have been
just picking this up as I go along, so I am unfamiliar with ways of
implementing rolling out of stuff like this. You said you use the
Workbook_Open event to load all the forms and modules - does this
mean that the users are opening a file on the network? How are users
accessing the functionality that you have built?

The form I have created does not need to use any open file for it's
operation - Rather it is used to grab data or open various types of
reports from folders where new versions of these reports are added
daily. It allows users to get the most recent versions or, specific
reports from specific years without having to manually dig thru the
network to do so. They access the form thru a button I added to
their excel toolbar.

On another note, I never thought about this before, but something
you said piqued my interest - You have a form with 30K lines of
code;
1) is there a limit to how much code you can have tied to a form?
2) are there performance issues when you have a form with so many
lines of code (like the file size slowing things down)?

 
Answer #8    Answered By: Lonnie Rogers     Answered On: Dec 04

Yeah, about the time you FINALLY decide to
turn to others for help, you find out the problem was
really simple and staring you in the face.
The solution never includes getting the earth to reverse
it's spin, it's usually something like: Is the light switch ON?


As to the other:
We probably ought to take it "off-line" since "technically", by
changing subjects we're "hijacking" the thread, even though
YOU started the thread.
the problem is, if someone is interested in a solution to automating
the update of modules, they wouldn't expect to find it in a discussion
of the .Show method.. see what I mean?

Also, it may be of interest to a limited audience...
So, I'll email you separately.

If anyone else is interested in the discussion, we can start a new thread.

BTW:
98.6257633% of the time, when I open a text file, I use:
if (fso.fileexists(textfilename)) then fso.opentextfile .......
to keep from doing EXACTLY what happened with you.

When you open the text file, are you using the OpenTextFile method?
If so, there is a ,create option that will cause the file to be created if it
does not exist.

 
Answer #9    Answered By: Hubba Akhtar     Answered On: Dec 04

On the text file, I am using the Open statement; So I need to either
include a test for the existence of the file or switch to the
OpenTextFile method and have it create it if it doesn't exist.

Thanks for all the past (& future) help!!

 
Didn't find what you were looking for? Find more on Cannot .Show a form that was imported? Or get search suggestion and latest updates.




Tagged: