Excel Import Form auswählen

  • Hallo,
    folgender Scriptauszug leifert mir alle Formulare einer DB, um das Formular auszwählen, in das Excel die Daten importieren soll:
    =============
    Get list of form names
    x=0

    Print "Preparing List of Database Forms ..."

    Forall f In db.Forms
    Redim Preserve formlist(x)
    formlist(x)=f.name
    x=x+1
    Print "Preparing List of Database Forms ..."& Cstr(x)
    End Forall

    'Sort the form names for the dialog box
    indexLo= Lbound(formlist)
    indexHi= Ubound(formlist)
    Call QuickSort(formlist , indexLo, indexHi)

    'Choose the form to use for import
    formname = uiws.Prompt(4, "Choose Import Form", "Please select which form is to be used for this input.", formlist(0), formlist)
    If formname= "" Then End

    'Get the form object so that we can check field names
    Set form= db.GetForm(formname)

    'If the form has an alias, use it to select the form
    If Not Isempty(form.Aliases) Then
    Forall a In form.Aliases
    formname=a
    End Forall 'a In form.Aliases
    End If 'Not Isempty(form.Aliases)


    ==============
    nun wollte ich dass keine Liste erfolgt, sondern standardmäßig immer ein bestimmtes Formular [0. PTF | PDF_D] gewählt wird.
    da habe ich mir gedacht, dass ich einfach diese Zeile ändere:


    formname = 0. PTF
    anstattt
    formname = uiws.Prompt(4, "Choose Import Form", "Please select which form is to be used for this input.", formlist(0), formlist)


    Bekomme aber immer Fehler schon vor dem test, was mache ich falsch?


    Ron

  • Danek, für die Info.
    Habe jetzt folgdenden Text:
    'Get list of form names
    ' x=0

    ' Print "Preparing List of Database Forms ..."

    ' Forall f In db.Forms
    ' Redim Preserve formlist(x)
    ' formlist(x)=f.name
    ' x=x+1
    ' Print "Preparing List of Database Forms ..."& Cstr(x)
    ' End Forall

    'Sort the form names for the dialog box
    ' indexLo= Lbound(formlist)
    ' indexHi= Ubound(formlist)
    ' Call QuickSort(formlist , indexLo, indexHi)

    'Choose the form to use for import
    ' formname = uiws.Prompt(4, "Choose Import Form", "Please select which form is to be used for this input.", formlist(0), formlist)
    formname = "PDF_D"
    If formname= "" Then End

    'Get the form object so that we can check field names
    Set form= db.GetForm(formname)

    'If the form has an alias, use it to select the form
    If Not Isempty(form.Aliases) Then
    Forall a In form.Aliases
    formname=a
    End Forall 'a In form.Aliases
    End If 'Not Isempty(form.Aliases)


    und es geht nachedm ich den Aliasnamen PDF_D des Formulars 0.PTF eingegeben habe.
    Danke für die Hilfe
    Ron