Welcome to Golden Software Support

GridConvert Error

Comments

2 comments

  • Avatar
    Jennifer Woodson

    Hi nasser186,

    I'm not sure why you would receive that error in VBA. There is no 4th parameter for this method. We don't support VBA, but I can run the following code successfully in Scripter with no errors.

    Sub Main
    Dim SurferApp As Object
    Set SurferApp = CreateObject("Surfer.Application")
    SurferApp.GridConvert(InGrid:="C:\Temp\MyFile.grd", OutGrid:="C:\Temp\Myfile.zmap",
    OutFmt:=srfGridFmtZMap)
    End Sub

    Is the Surfer Type Library referenced? Have Scripter and Surfer been run interactively as an administrator? If not, right-click the EXE file, and choose Run As Administrator. Then , close the programs and attempt to run the script. Does that work?

    Thanks,

    Jennifer

    0
    Comment actions Permalink
  • Avatar
    Jennifer Woodson

    Hi again nasser186,

    I just realized that perhaps you're receiving the error below when using the GridConvert2 method, rather than GridConvert. GridConvert2 does have a 4th parameter, which is OutFmt. I still recommend being sure the correct Surfer Type Library is being referenced, but you could try using the numeric value for srfGridFmtZMap, which is 23. You can find this in the Surfer help: http://surferhelp.goldensoftware.com/surfer.htm#t=autoenum%2Flink_enum_srfgridformat.htm.

    So, your code would look like below.

    Dim SurferApp As Object
    Set SurferApp = CreateObject("Surfer.Application")
    Call SurferApp.GridConvert(InGrid:="C:\Temp\MyFile.grd", OutGrid:="C:\Temp\Myfile.zmap", OutFmt:=23)

    Thanks,

    Jennifer

    0
    Comment actions Permalink

Please sign in to leave a comment.