Attribute VB_Name = "CreatePKM" ' ' This function takes the current spectrum in Data Explorer and create a Grams' .pkm file with the same file name as ' the opened data file. ' ' Author: Joe Zhou ' Date: July, 2000 ' Sub CreatePKM() Dim nPeaks As Long Dim dStart As Double, dEnd As Double Dim vPeaks As Variant Dim sFileName As String Dim i As Long dStart = 0# dEnd = 0# ' Assemble the PKM file name sFileName = Replace(ActiveDocument.FullName, ".dat", ".pkm") ' Get peak table nPeaks = ActiveDocument.SpecView.GetPeakData(deSpecPeakAll, deSpecPeakSortMass, dStart, dEnd, vPeaks) If (nPeaks > 0) Then ' Open the PKM file for writing Open sFileName For Output As #1 ' Put out the PKM headers Print #1, """Peak Table""" Print #1, "OP=0" Print #1, "Center X Peak Y Left X Right X Time X Mass Difference Name" Print #1, "STD.Misc Height Left Y Right Y %Height,Width,%Area,%Quan,H/A" ' Print each peak For i = 0 To nPeaks - 1 Print #1, Format(vPeaks(i, deSpecPeakCentroidMass), "####0.0000"); " "; _ Format(vPeaks(i, deSpecPeakPeakHeight), "####0.0000"); " "; _ Format(vPeaks(i, deSpecPeakStart), "####0.0000"); " "; _ Format(vPeaks(i, deSpecPeakEnd), "####0.0000"); " 0 "; _ Format(vPeaks(i, deSpecPeakCentroidMass), "####0.000") Print #1, "C "; "0.? "; "0 "; "0 "; "0 " Next i ' Close the PKM file Close #1 End If End Sub