Share via

Application.ActivePresentation.Slides.InsertFromFile unable to insert .pot file.

Anonymous
2012-05-18T11:09:36+00:00

I am using this line to insert a .pot file

Application.ActivePresentation.Slides.InsertFromFile(FilePath + sTemplateName, lSlideIndex, 1, 1)

but every time I am getting error couldn't access this file.

I am using absolute path to .pot file i.e.  "Local Disk (C):Applications:Microsoft Office 2011:Office:Media:Templates:Presentations:MCQ.pot".

Please let me know if there is any workaround.

Microsoft 365 and Office | PowerPoint | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2012-05-25T11:24:35+00:00

Thanks all,

Issue resolved as VBA on MAC uses path like this "/Applications/XYZ/Templates/".

Was this answer helpful?

0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Jim G 134K Reputation points MVP Volunteer Moderator
    2012-05-22T04:10:08+00:00

    I suspect the parentheses in the name of the hard disk might be causing a problem. Rename the hard drive without the parentheses and see if that fixes the problem.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2012-05-18T13:18:05+00:00

    Hi David,

    Thanks for reply :)

    The same code is working fine if I have the PPT file saved on the same path where my .pot files are and I am using relative path to these .pot files. Relative path is "Templates:MCQ.pot".

    And even if I copy these .pot files to MSOffice template folder and use relative path it works fine.

    But if I reference these .pot files using absolute path then again its not working.

    Application.ActivePresentation.Slides.InsertFromFile(:Templates:MCQ.pot", lSlideIndex, 1, 1)

    This line of code working fine if I have relative path and the ppt is saved on the same location where Template folder is.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2012-05-18T13:05:17+00:00

    Hmm. That seems odd. Generally, a template doesn't have any slides to insert. The template file would just have a slide design. Could that be the error you are getting?

    David Marcovitz

    Author of Powerful PowerPoint for Educators

    http://www.PowerfulPowerPoint.com/

    Was this answer helpful?

    0 comments No comments