1. Problem Summary
The WinCC Graphics Designer VBA method Application.Documents.Open raises Microsoft Visual Basic Run-time error 70 — Permission Denied whenever the path passed to it ends with the faceplate file extension *.fpt. The same call succeeds when the path ends with *.pdl (Picture Display). The error is deterministic: every iteration of a For Each loop that opens faceplates returns the same error code, with no file-system ACL involvement.
The failure is structural rather than environmental. The Documents collection exposed by Application only knows how to register *.pdl documents; *.fpt files live in a different editor surface (Faceplate Designer / project library) and are not exposed through the Documents collection's Open method. The VBA host therefore refuses the open request before any file I/O takes place, returning the generic Err.Number = 70.
.pdl from the same project folder with the same code (only the extension differs), the failure is API-scope, not permissions. Proceed to Section 3 (Root Cause). If .pdl also fails, escalate to Section 5 (Diagnostics).2. Environment and Affected Versions
The behavior described applies to WinCC V7 graphics-designer VBA automation. Confirm the host before drawing conclusions:
| WinCC Edition | Scope of Application.Documents.Open
|
Faceplate Type |
|---|---|---|
| WinCC V7.0 / V7.2 |
*.pdl only (verified across SP updates) |
*.fpt in GraCS subfolder |
| WinCC V7.3 |
*.pdl only |
*.fpt — not addressable through Documents.Open |
| WinCC V7.4 |
*.pdl only |
*.fpt — same restriction; no API extension in SP1/SP2 |
| WinCC V7.5 / V7.5 SP2 |
*.pdl only |
*.fpt — restriction unchanged |
| TIA Portal WinCC Comfort/Advanced | Different object model (HMI screen objects via engineering API), no Application.Documents
|
Faceplate editing via TIA Portal scripting API, not VBA Documents.Open
|
| TIA Portal WinCC Professional | Uses WinCC RT scripting (VBS / C / ANSI-C), not host VBA | Faceplate configuration through TIA portal scripts; same conceptual restriction on Documents collection |
If you are targeting a TIA Portal WinCC project, jump to Section 7 — Faceplate Editing via the TIA Scripting Model; the classic-VBA Application.Documents.Open syntax does not apply.
3. Root Cause: VBA Documents.Open API Scope
The WinCC Graphics Designer VBA object model exposes a top-level Application object whose Documents collection represents only the picture documents the editor can render. Internally this collection is a thin wrapper around the Graphics Designer document registry. The registry entries are populated from *.pdl files (and a few internal editor files such as @*.pdl). When Documents.Open is invoked with a path whose extension is not in the registry, the WinCC VBA host returns Err.Number = 70 rather than 53 (file not found) or 76 (path not found). The choice of 70 is intentional: from the host's perspective the user is asking for an operation the API cannot authorize, and the failure is reported as a permission-class error.
Faceplates (*.fpt) are stored in the project subfolder GraCS\<project>\Faceplates\ (or the equivalent library folder). They are managed by a separate editor — the Faceplate Designer — that registers its documents in a parallel structure. That parallel structure is reachable through different VBA entry points (see Section 6), not through Documents.Open.
3.1 Why the same code works on *.pdl
Picture Display files (*.pdl) are the primary editable artifact of the Graphics Designer. Documents.Open is the documented automation entry point for them and supports three open modes exposed by the HmiOpenDocumentType enumeration:
-
HmiOpenDocumentTypeVisible— opens the picture in the foreground and activates it. -
HmiOpenDocumentTypeInvisible— loads the picture into the document object model without UI focus; required for headless modification loops. -
HmiOpenDocumentTypeModal— opens the picture as a modal editor window.
These modes are dispatched only when the host recognizes the file as a picture document. *.fpt files bypass the dispatcher and never reach the mode handler, hence the early Err 70.
4. Reproducing the Error
The original report uses a For Each loop over the result of a directory scan and tries to open each faceplate invisibly:
Dim sFile As String
Dim doc As HMIDocument
sFile = Dir("C:\WinCC\Projects\MyProject\GraCS\Faceplates\*.fpt")
Do While Len(sFile) > 0
On Error Resume Next
Set doc = Application.Documents.Open(sFile, HmiOpenDocumentTypeInvisible)
If Err.Number <> 0 Then
Debug.Print "Run-time error " & Err.Number & _
" on " & sFile & ": " & Err.Description
' Err.Number = 70, Err.Description = "Permission denied"
End If
On Error GoTo 0
sFile = Dir()
Loop
Output (each iteration):
Run-time error 70 on Faceplate_A.fpt: Permission denied
Run-time error 70 on Faceplate_B.fpt: Permission denied
Run-time error 70 on Faceplate_C.fpt: Permission denied
Replace the wildcard with *.pdl and the same loop completes with no error: each picture is loaded into the document object model and can be enumerated for objects, properties, and dynamic scripts.
GraCS\Faceplates folder and on the project master data folder. If those rights are present and the .pdl case works, the failure is API-scope (Section 3).5. Diagnostic Steps Before Contacting Support
Work through these checks in order. Each one either rules in the API-scope cause or points elsewhere.
-
Compare extensions in the same script. Loop over
*.pdland*.fptin a single procedure. If only*.fptfails withErr 70, the issue is API-scope. -
Validate the file is a real faceplate. Open the file in Notepad++ or another text editor and confirm the XML root is
<Faceplate>or<HMI_Faceplate>(varies by WinCC version). If the file is corrupted or has a wrong header, the API may reject it with a different error code. -
Verify file ACLs. Right-click the
.fptfile → Properties → Security. The user account must have at least Read & Execute, Write, and Modify. If the account is missing Modify, Windows-level denial produces the sameErr 70; in that case the API never sees the request. -
Check whether the project is open read-only. In WinCC Explorer, Project → Open: a project opened read-only blocks write-mode automation including
Documents.Openwith theInvisiblemode intended for editing. Close the read-only handle and reopen with write access. - Check WinCC service state. The WinCC runtime, alarm logging, and tag logging services must be started or stopped according to whether you are editing offline (services stopped) or modifying runtime documents (services started). Mixed states can produce authorization errors in VBA.
-
Capture
Err.HelpContextandErr.Source. TheErr.Sourcestring for the API-scope case is typicallyWinCC Graphics Designer. A different source (for exampleVBAProjector a Windows shell component) indicates a non-API failure.
If all six checks pass and the failure persists, the behavior matches the known limitation of Documents.Open against *.fpt documents (Section 3) and you should move to Section 6.
6. Supported Workarounds
Three engineering approaches have been used in production environments to apply DynamicScript-style changes across faceplates without relying on Documents.Open:
6.1 Open the Faceplate from its Reference Screen
Every faceplate instance in a WinCC picture is rendered through a faceplate object whose configuration references the *.fpt type. By opening the containing *.pdl with Documents.Open and walking the HMIObjects collection, you can enumerate faceplate references and read their dynamic-configuration properties. This path does not require Documents.Open to accept a *.fpt path.
Dim pic As HMIDocument
Dim obj As HMIObject
Dim fp As HMIObject
Set pic = Application.Documents.Open( _
"C:\WinCC\Projects\MyProject\GraCS\Main.pdl", _
HmiOpenDocumentTypeInvisible)
For Each obj In pic.HMIObjects
If obj.Type = "HMIFaceplate" Then
Debug.Print obj.Name, obj.Property("FaceplateType")
' Read-only access via the reference is feasible;
' write-back requires the type-level path below.
End If
Next obj
6.2 Edit the Faceplate Type via the Graphics Designer UI + Project Macros
For changes that must apply to the type (i.e., to every instance of the faceplate), open the faceplate manually in Graphics Designer once, then drive edits through the Application object after the document is loaded by the user. The macro runs inside the Graphics Designer process where the document is already registered:
' Run this macro from inside Graphics Designer with the
' faceplate already open as the active document.
Sub ApplyDynamicScriptToAllObjects()
Dim doc As HMIDocument
Dim o As HMIObject
Set doc = Application.ActiveDocument ' the open *.fpt
For Each o In doc.HMIObjects
Select Case o.Name
Case "Rectangle_1"
o.Properties("Width").Dynamic = _
"HMIRuntime.Tags(""Width"").Read"
Case "IOField_1"
o.Properties("OutputValue").Dynamic = _
"HMIRuntime.Tags(""Value"").Read"
End Select
Next o
doc.Save
End Sub
This pattern uses the same object model as Documents.Open but obtains the document from ActiveDocument (already loaded by the user), so it never requests a faceplate through the registration-restricted Documents.Open entry point.
6.3 Bulk-Modify via GraCS File Editing
Faceplate files are XML. For deterministic, scripted changes to the dynamic property table of every faceplate, parse *.fpt directly, modify the relevant <Dynamic> nodes, and write back. Recommended only when no live runtime is attached and the project is checked out of source control.
' PowerShell sketch for an offline bulk edit
Get-ChildItem "C:\WinCC\Projects\MyProject\GraCS\Faceplates\*.fpt" |
ForEach-Object {
$xml = [xml](Get-Content $_.FullName)
$node = $xml.SelectSingleNode("//Property[@name='Width']/Dynamic")
if ($node) {
$node.InnerText = 'HMIRuntime.Tags("Width").Read'
$xml.Save($_.FullName)
}
}
*.fpt files. Validate the result by recompiling the OS and checking the faceplate instances in test mode.7. Verification Checklist
After applying any of the workarounds, confirm the change has propagated correctly:
- Reopen the Graphics Designer, open the modified
*.fptmanually, and visually inspect the property grid of each touched object. Dynamic values must show in the Dynamic column. - From the faceplate, click Compile → OS. Compile errors related to the modified dynamics (for example unresolved tag references) will surface here.
- Open a host picture that contains an instance of the modified faceplate and recompile. Any orphaned references will be flagged at the picture level.
- Start WinCC Runtime in test mode and trigger the dynamic event on a representative instance. Confirm the expected value updates.
- If the project is under version control, commit the modified
*.fptfiles together with the*.pdlfiles that reference them to keep the change set consistent.
8. Long-Term Path: Escalation to Siemens Technical Support
When the workaround does not fit the maintenance process — for example when validation requires that faceplate types be touched only via the documented API — open a support request through the official Siemens Industry Online Support channel:
- Navigate to the Siemens Industry Online Support portal.
- Sign in with your Siemens customer account.
- Open a new support request, select product SIMATIC WinCC, and indicate the WinCC version (for example V7.5 SP2) and the exact error: "Application.Documents.Open on *.fpt file raises VBA Run-time error 70."
- Attach a minimal VBA reproduction project, a sample
*.fpt, and the WinCC project version (CS file). - Reference the
Documents.Openmethod from the WinCC VBA reference and explicitly request a feature extension or documented limitation note.
Siemens support will triage the request with WinCC development. Be aware that API extensions of this kind are typically scheduled into a future SP release rather than back-ported, so plan the production cut-over accordingly.
9. Frequently Asked Questions
Why does Application.Documents.Open work on *.pdl but fail on *.fpt with Run-time error 70?
The Documents collection only registers picture (*.pdl) documents. Faceplate (*.fpt) documents live in a separate registry managed by the Faceplate Designer and are not exposed through Documents.Open. The host returns Err.Number = 70 when the file type is not in scope.
Is Run-time error 70 always a permission problem?
No. VBA raises error 70 both for Windows ACL denials and for API-level operation refusals. The most reliable way to discriminate is to run the same code against a *.pdl file: if .pdl succeeds and .fpt fails, the error is API-scope rather than file-system.
Can I open a faceplate headlessly via the WinCC VBA object model?
Indirectly. Open a containing *.pdl with HmiOpenDocumentTypeInvisible and walk its HMIObjects for faceplate references. For type-level edits, run a macro from inside Graphics Designer while the *.fpt is the active document; that path uses Application.ActiveDocument and avoids Documents.Open entirely.
Which WinCC versions are affected?
The behavior has been reproduced on WinCC V7.0 through V7.5 SP2. TIA Portal WinCC Comfort/Advanced and WinCC Professional use a different scripting model (engineering API / runtime VBS-C) and the Application.Documents.Open VBA construct does not apply to them.
Is there a hotfix or SP that adds *.fpt support to Documents.Open?
No public Siemens release note declares such an extension as of the WinCC V7.5 SP2 update line. For confirmed scope on later SPs and TIA Portal versions, search the Siemens Industry Online Support knowledge base or open a support ticket with a minimal reproduction.