0

We use PcSchematic for our electric drawings. And we use PDM to manage the revision. I would like to write into the pcschematic file with the current revision from PDM.

A pcSchematic file can be opened with a notepad. so what I would like to do is:

Dim filePath as string = "C:\16368.04.PRO"

  1. Open file with notepad Process.Start("notepad", filePath)
  2. find and replace a line
  3. save
  4. close

I have tried this:

Dim objFSO
Dim objTS
objFSO = CreateObject("Scripting.FileSystemObject")
objTS = objFSO.OpenTextFile(filePath, 2)

From this Text file in VBA: Open/Find Replace/SaveAs/Close File

but it only seems to work for .txt files

Can anyone point me in the right direction?

  • If you can open the file with notepad, it's likely a textfile. Note that the syntax you use to define the filename is not valid in VBA - you cannot declare a variable and assing a value to in in the same statement. However, it seems that you don't need a variable anyhow, so change the line to `Const filePath= "C:\16368.04.PRO"` – FunThomas Jul 19 '21 at 13:42
  • About the filepath definition, it was only to save time/space, I have declared it in one line and assigned it a value in another line. – Sussi Birkevang Jul 20 '21 at 05:21

0 Answers0