Kkula
Browse Questions » SIMATIC WinCC (TIA Portal): Auto Information Report Copy

About User

Questions Asked: 37.9K

Answers Given: 32

0
  • Open

SIMATIC WinCC (TIA Portal): Auto Information Report Copy

Hi Guys,
Situation I am in:
I have a SIMATI  HMI (TP700 Comfort & using V13 of TIA), the HMI logs data from the PLC.
I want to be able to save the logged data onto a remote PC, but I would like the saved name of the file to be unique I.E. the date.
I also need the file to save when a tag value is true (boolean)
I don't have a great deal of experience in VBA, im still learning. Can anyone help me?
Thanks in advance,
Oli

0 Likes 0 Favourites 0 Followers 0 Comments
Answers(1)

Saving HMI Log Data to Remote PC with Unique Filenames (Date-Based)

Hi Oli,

You can achieve this using a combination of HMI data logging, VBA scripting, and potentially Windows scripting (like a scheduled task or a simple script triggered by file creation). Here’s a breakdown of how to approach this:

  1. HMI Data Logging Configuration: Configure your TP700 Comfort HMI in TIA Portal V13 to log the desired data.
  2. VBA Scripting: Use VBA to trigger the file transfer when your boolean tag becomes TRUE. This script will:
    • Determine the current date in a suitable format for your filename (e.g., "YYYYMMDD").
    • Construct the full filename including the date.
    • Copy the log file from the HMI to the remote PC using Windows scripting commands (see below).
  3. Windows Scripting (for file transfer): Within your VBA script, you can utilize Windows scripting (e.g., using the Shell object to execute a xcopy or robocopy command). This will copy the log file. Ensure the remote PC is accessible over the network and that the HMI has the necessary permissions.

Example VBA Snippet (Conceptual):


Sub TransferLogFile()
  Dim strDate As String
  Dim strLogFileName As String
  Dim strRemotePath As String
  
  strDate = Format(Now, "YYYYMMDD")
  strLogFileName = "HMI_Log_" & strDate & ".csv" ' Or your log file extension
  strRemotePath = "\\RemotePC\SharedFolder\" & strLogFileName

  ' Example using Shell to execute xcopy (adjust paths as needed)
  Shell "xcopy ""C:\Siemens\WinCC\Logs\YourLogFile.csv"" " & strRemotePath, vbNormalFocus
End Sub

Important Considerations:

  • Permissions: Ensure the HMI user account has write access to the remote PC’s shared folder.
  • Error Handling: Implement error handling in your VBA script to catch potential issues during file transfer.
  • Network Connectivity: Verify consistent network connectivity between the HMI and the remote PC.
  • TIA Portal Documentation: Refer to the Siemens TIA Portal documentation for detailed information on data logging and VBA scripting: TIA Portal Documentation
  • SiePortal: Search SiePortal for similar examples and troubleshooting tips: SiePortal

Start with a simple test to verify file transfer before implementing the full logic. Good luck!

Best regards,
Siemens Self Support

0