Troubleshooting
Opening PDF Files from WinCC Flexible 2008 Runtime
Short answer
WinCC flexible 2008 can open a PDF or Word file, but not with Execute: that statement runs its string as script code, so a bare path launches nothing. On PC runtime, a button script calls the Windows shell object's Run method with the document's full path, or StartProgram starts the viewer; the installed application and its file association do the rendering. On panels, the runtime's own PDF viewer displays the file within its documented format limit.

On this page
Yes, WinCC flexible 2008 can open a PDF or a Word document, but not with an Execute line. Execute in a VBScript runs its string as script code, and a file path is not code, so the button click ends with no viewer and no useful error. The runtime does not render documents itself: on a PC runtime target you hand the file's full path to the Windows shell from a button script, or start the viewer with StartProgram, and the installed application does the rendering. On panels, the runtime's own PDF viewer displays the file. What follows is the working script, the checks that isolate each failure, and the decision for every target.
Why the Execute line opens nothing #
In the failing script the line reads Execute "C:\Projects\Ihlabela\WinCC Flex Project\AddDelTanker.Pdf". VBScript's Execute statement parses its string as script statements and runs them inside the script; it never calls the operating system, so a bare path gives it nothing it can run. Depending on the runtime's error reporting, a script error is logged or nothing shows at all, which is why the click looks completely dead. Delete the line; it cannot be repaired into a document launch.
Hold on to a second fact: WinCC flexible Runtime cannot display a PDF or a Word file by itself. Something outside the HMI process does the rendering — a desktop viewer on a PC-based target, or the built-in viewer on panels that carry one. Every working method below is a way of asking that viewer to show the file.
Read the symptom before changing anything:
| What you observe | Where the fault sits | Decisive check |
|---|---|---|
| No reaction traceable to the button | Event or script binding | Add a temporary alarm line to the same event and press again |
| Alarm line appears, no viewer opens | Path, association, viewer or shell object | Open the same path from the target's desktop |
| Viewer opens and reports the file missing | Path or storage mapping on the target | Browse to the exact path on the runtime target |
| Works on the engineering station, dead in runtime | The deployed target's folders and account | Repeat the direct open under the runtime account |
| PDF opens, Word does not | The association for that one extension | Test each extension separately on the target |
The launch route that works on PC runtime #
CreateObject("Wscript.Shell") creates the Windows shell automation object, and its Run method hands the document path to Windows. Windows starts the application registered for the file's extension — a PDF reader or a Word-compatible program — and that application renders the file; the HMI script only initiates the launch. It is the same mechanism as double-clicking the file in Explorer, which is why the direct-open test below predicts what the script will do.
Four conditions must hold, and any one of them alone reproduces the dead button: the target provides the Windows scripting object (a PC running the PC runtime does — the configuration covered in running a WinCC flexible 2008 project in PC runtime), the runtime's logon account can read the file, the path resolves on the target, and an application is associated with the extension. In the script below, objWshShell is a variable name of our own choosing, declared with Dim (a VBScript variable is a Variant); CreateObject, Run and ShowSystemAlarm are documented calls and keep their names exactly.
The button script, step by step #
- Open the script your button already calls — in the failing case it was named
Script_AddDelTanker— or create a new script for the document action. - Replace its content with the shell-launch code, changing only the path:
'Open a PDF or Word document through the Windows shell
Dim objWshShell
Set objWshShell = CreateObject("Wscript.Shell")
objWshShell.Run "D:\Documents\A354ELECTRICAL.pdf", 1
ShowSystemAlarm "pdf opened"
Set objWshShell = Nothing
- Keep the event binding you already made: the button event calls the script, and nothing else on the screen changes.
- Compile, then transfer or start the runtime on the deployed target, not only in simulation.
- Press the button once. The pass condition is the viewer window visible with the document in it.
The 1 at the end of the Run line requests a normal, visible window. The ShowSystemAlarm line is an execution trace, not a result: it proves the script reached that line, and it fires before the viewer has loaded or reported anything, so never read it as confirmation that the file displayed. Note also that the runtime keeps running behind the viewer — an open document never pauses the machine — so place these buttons where reading a manual cannot compete with controlling the process.
Path discipline on the runtime target #
The path in the script must exist on the machine that runs the runtime, readable by the account the runtime uses. The engineering station's directory tree means nothing there; in the failing example that is a second fault, independent of Execute.
The arrangement reported working for this method keeps the document a single subfolder below the drive root, in a D:\abc-style location. Treat that as a deployment convention, not a documented depth limit: it removes typing errors and mapping differences, and the method was confirmed working at that depth.
Worked example #
The failing path C:\Projects\Ihlabela\WinCC Flex Project\AddDelTanker.Pdf sits three subfolders below the drive root: Projects (level 1), Ihlabela (level 2), WinCC Flex Project (level 3). The working convention is one subfolder, so the file moves 3 - 1 = 2 levels up: deploy it, for example, as D:\Manuals\AddDelTanker.pdf and put that path into the Run line. Both faults — the dead Execute call and the engineering-only tree — are then gone.
Test the file outside WinCC flexible before you blame the script: log on with the runtime's account and open the exact path from the desktop. That one action proves the file, the permissions, the association and the viewer. If the wrong application starts, the extension's association is damaged on that Windows install and the script inherits the damage — repair the association, not the script.
Panels display the file in their own viewer #
On WinCC flexible panels that carry a PDF viewer you do not launch a desktop application at all: the viewer displays the file inside the runtime, and the shell route above is the wrong tool. The documented limit to check first comes from Siemens support for the MP377: the PDF file must have been created for Acrobat 5.x — PDF format 1.4 — or it will not display properly. When a panel shows the file blank, clipped or distorted, re-save the PDF at that compatibility level before touching the HMI project. A Word file has no viewer on these panels; convert it to PDF at that format and transfer the converted file.
On a Unified Comfort panel the same dead button has a different cause and a different fix; that generation is covered in why the PDF button does nothing on a Unified Comfort panel.
Verification checklist #
Run these in order; each one isolates a single dependency:
- Binding: the alarm trace appears exactly once per press. If it never appears, the fault is the event or script link — fix that first.
- Direct open: the exact path opens from the target's desktop under the runtime account. A failure here is path, permission, association or viewer, never the script.
- Shell creation:
CreateObjectcompletes without a scripting error. An error at this point means the target does not provide this route. - Viewer visible: the registered application shows the document. The alarm line alone is not a pass.
- Repeat after a runtime restart and after reopening the screen with the button; this catches paths and mappings that existed only during engineering tests.
The decision for each case #
- PC runtime, PDF or Word document: use the shell script with the file's full path, or StartProgram. The installed viewer and its file association do the rendering.
- Panel with a PDF viewer, MP377 generation: display the file in the runtime viewer and keep it at PDF format 1.4 (Acrobat 5.x).
- Word document on a panel: convert it to PDF at that format first; there is no Word application to launch.
- A button with an
Executeline in it: delete the line.Executeruns script code and can never start a document.
That is the whole method: the runtime asks, the operating system or the panel viewer answers, and the five checks above tell you in a minute which of the two is not doing its job.
Questions asked
Can StartProgram open the document without a script?
On a PC-based target, yes. StartProgram is the WinCC flexible system function that starts the named program on the HMI device while the runtime keeps running. Because it starts programs rather than files, if passing the document path alone does not launch it on your target, use the shell script instead, which resolves the file association for you.
What does the 1 at the end of the Run line do?
It is the window style. Value 1 opens the started application in a normal, visible window. A hidden window style would start the reader invisibly, and the button would look broken even though the launch succeeded, so keep the 1 while you commission and test the screen.
My file ends in a capitalized Pdf extension. Does that break the launch?
No. Windows file associations are case-insensitive, so AddDelTanker.Pdf resolves to the same registered application as a lowercase .pdf extension. The capitalized ending is not the fault and never was; the Execute line is. Rename the file only if your deployment convention wants lowercase everywhere.
Can the document live on a mapped network drive?
It can, but drive letters are mapped per logon session, and the runtime may run under an account that never receives the letter you see on the engineering station. Prefer a local path in the deployed documents folder, or a UNC path the runtime account can reach, and prove it with the direct-open test before changing the script.

