Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Same code works here but not there. Why?

  Asked By: Madison    Date: Oct 10    Category: MS Office    Views: 822
  

I have been using the VBA Function to capture the Windows
Username for student quizzes in PowerPoint posted by A.J Morales
(message #8684). The code has been working great until this week. I
create my files in PPT 2007 and run mostly in PPT 2003. The code
continues to work on the computer I create my files. But a couple of
the files with this code now say "Can't find project or library"
highlighting the "Left$" when running in PPT 2003. Other files work
great with the exact same code imported from the same bas file. My
thoughts are the code has become corrupted in the files that don't
work anymore, but I don't know how to clean the PowerPoint files. I
have tried removing then importing the bas files again and copying
the working code over the non-working code to no avail. I can't find
a PowerPoint VBA code cleaner like the Excel code cleaner here
http://www.appspro.com/Utilities/CodeCleaner.htm . Please help me!
This problem is way over my head.

Share: 

 

5 Answers Found

 
Answer #1    Answered By: Faiza Mian     Answered On: Oct 10

Tracking this one down can sometimes be difficult.
A couple of things you said are "disturbing".
You said '...highlighting the "Left$"'.
Is the "$" part of the code? I don't recognize that
convention. I've used it other places referring to addresses, but
not with functions. Could it be that you intended to use
the "left(" function  but somethow got a $ inserted and it's trying
to find Left$ in the function library?
"... a couple of files  with this code  now say..."
not ALL files with this code?
In the VBA editor of the 2003 application, check
the References panel and see if there are any "not found" libraries.
sometimes, if there is a library that cannot be found, it
fails to load the rest of the libraries.
Can you post a snippet of the offending code?

 
Answer #2    Answered By: Felix Gray     Answered On: Oct 10

The $ is from the old school functions and they were used to indicate that
this was a string function. Now, the functions omit the "$", but some VBA
environments will accept either form.

To Roger: Check the references in the VBA environment in the two versions to
see if you are missing something.

 
Answer #3    Answered By: Sultana Tabassum     Answered On: Oct 10

You were right! I reference the Excel object library in PowerPoint.
When copying it from PowerPoint 2007 to PowerPoint 2003 the Microsoft
Office Excel 12 Object Library remained and was missing. Going in on
an Office 2003 computer and changing to the Excel 11 Object Library
fixed the Problem. I never would I have figured that out.

 
Answer #4    Answered By: Hollie Hughes     Answered On: Oct 10

Sounds good, but I was expecting a different library to be missing.



If you can remember where the error was, what was the Left$() enclosing? I
think the Left$ was a bit of a red herring and what it was around was the
missing element.



Adding a reference to the Excel library should only add links to Excel
specific features. A reference to "Visual Basic for Applications" would
affect VBA type elements like Left$ (and a whole lot more).

 
Answer #5    Answered By: Jackson Williams     Answered On: Oct 10

The $ at the end of functions indicates a string being returned. I believe
that this has been left out of some function  in VBA now, but in fact I have
yet to find a place where they're not accepted. Most functions are "doubled"
up in that there is for example both a Left() function and a Left$()
function.

I actually bemoan the $s demise because I knew that if I used it it
definateley would return a string.

IMHO think it's fading use is due to VBS... Visual Basic Scripting... Which
I've dabbled in a little.

Due to advice from... amongst others... Our very own Greg Chapman, I don't
use it any more because of possible problems down the line in forthcoming
versions of VBA.

 
Didn't find what you were looking for? Find more on Same code works here but not there. Why? Or get search suggestion and latest updates.




Tagged: