Microsoft KB Archive/303737

= FP: Error Message: Permission Denied Running VBA Macro in HTML View =

Article ID: 303737

Article Last Modified on 1/31/2007

-

APPLIES TO


 * Microsoft FrontPage 2000 Standard Edition
 * Microsoft FrontPage 2002 Standard Edition

-



This article was previously published under Q303737



SYMPTOMS
When you run a Microsoft Visual Basic for Applications macro in HTML view, you receive the following error message:

Run-time error '70':

Permission denied.

If you click Debug, switch to Normal view, and then click Continue, you receive one of the following additional error messages:

Run-time error '-2147418113 (8000ffff)':

Automation error

Catastrophic failure.

-or-

Run-time error '-2147418113 (8000ffff)':

Method 'insertAdjacentHTML' of object 'DispIHTMLUnknownElement' failed.



CAUSE
This problem can occur if the Visual Basic for Applications macro uses a method to manipulate the HTML on the page when in HTML view. For example, if you use either the InsertAdjacentHTML or the CreateRange methods, you may receive the error message described in the &quot;Symptoms&quot; section.



RESOLUTION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. To resolve this problem, add code to your macro that changes the view mode to Normal view before editing the HTML. The following sample macro is a template for a Visual Basic for Applications subroutine that stores the original view mode, switches to normal view to execute any code, and then resets the original view mode: Sub MySub Dim lngCurrent As Long ' Get the original view mode and store it for later. lngViewMode = Application.ActivePageWindow.ViewMode ' Switch to Normal view. Application.ActivePageWindow.ViewMode = fpPageViewNormal

' Other code goes here.

' Switch back to the original view. Application.ActivePageWindow.ViewMode = lngViewMode End Sub



MORE INFORMATION
For additional information about working with Visual Basic for Applications methods and HTML, click the article number below to view the article in the Microsoft Knowledge Base:

242315 FP2000: How to Insert HTML at the Insertion Point by Using VBA

Additional query words: prb front page

Keywords: kbprb KB303737

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.