Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

This article was previously published under Q303737

↑ Back to the top


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.

↑ Back to the top


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 "Symptoms" section.

↑ Back to the top


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
				

↑ Back to the top


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

↑ Back to the top


Keywords: KB303737, kbprb

↑ Back to the top

Article Info
Article ID : 303737
Revision : 4
Created on : 1/31/2007
Published on : 1/31/2007
Exists online : False
Views : 315