Issue in creating macro creates run time error 424

Asked By 40 points N/A Posted on -
qa-featured

Hello guys.

Basically I am trying to build a macro which will enter into the same folder same as active powerpoint file, see all the files in the folder, and add a series of buttons which are hyperlinks to all the files that meet the experienced the event????.ppt. I've used basic logic here.

My problem is when I am running the program how will I load an array with all of the paths. Experts said that System.IO.directory.getfiles (string, string, search Criteria) method, but a run time error 424 pop up. 

I am using PowerPoint 2010 but says that it is Visual Basic 7.0

Here are my codes, not all of it just the relevant parts

    myPath = ActivePresentation.Path

    FileNames = Directory.GetFiles(myPath, "????.ppt")

I’ve made some research and got in the MSDN library:

    'Declaration

    Public Shared Function GetFiles(path as string, searchPattern as string, searchOption as SearchOption) as string()

But, it didn't work either. The compiler doesn't like the line of code. (I tried putting it in the module and in a class).  I'll admit that I am good with code. I am a little expert, mostly of logic, but at present I am stuck with language right now.

So, please help me. Help will be appreciated cordially.

Thanks for any reply.

SHARE
Answered By 55 points N/A #90440

Issue in creating macro creates run time error 424

qa-featured

I think that you cannot define a macro to do such operations. Because they are usually used to handle operations and functions inside a file but you are trying to take them to the folder level and use different files.

However looking at your syntax of macro here is what you have to change in order to see if it works.

  • The parameter where are you are specifying the path or the file name, try the "%" sign instead of the "???".
  • Save the macro and see if it works.
  • Also when a macro is running, please make sure that all the files in that folder are closed because macros can have to edit them so they must be free from any kind of usage.

Related Questions