Salve ho questo problema:
devo esportare le variabili di un file project su delle tabelle access.
Non essendo espertissimo di access-project mi sono basato nello scrivere prima le variabili su excel.
Il problema che mi si pone e' quali colonne devo esportare esattamente?
Su vba/excel ho scritto, con una macro, tutti i valori delle variabili, dove, non sapendo le colonne da esportare, sto' andando a tentatvi per trovare i campi esatti.
Avrei bisogno che la macro magari mi scrivesse oltre i valori anche l'intestazione delle mie colonne cosi' saprei di preciso quali sto' esportando, ma non so come fare.
il codice che ho usato per esportare i campi su vba/excel e' questo:

codice:
Sub Add_MSProjectTask_estrazione_tutti_campi()
            
            Sheets("VARIABILI").Select
            ActiveCell.Select
            
            Dim x
        For x = 0 To 318 
'ho messo 318 in quanto mettendo 500 al 319 dava errore 
'e non proseguiva la macro, quindi credo si arrivi al massmo a 318
       
        ActiveCell.FormulaR1C1 = PjtObjTsk.Fields(x)
        ActiveCell.Offset(1, 0).Select
               
           Next x
           ActiveCell.Offset(-319, 1).Select
    
End Sub
Tramite una macro che mi hanno passato e di cui non conosco il funzionamento esatto passero' tutto su una tabella access.
Il codice della macro,prima di quella postata sopra e' questo:

codice:
Option Explicit

Global cnnDB1 As ADODB.Connection
Global rstMOP As ADODB.Recordset
Global rstMOP_Detail As ADODB.Recordset
Global PjtObjTsk As New ADODB.Recordset
Global nOrderNumber As Long
Public ExcelApp As Excel.Application

Sub Read_xxxx_Projects()
    Dim nAreaCount As Long
    Dim strMSProject As String
    Dim strDestMSProject As String
    Dim strSqlSel As String
    Dim fs
    Dim f
    Dim f1
    Dim fc
    Dim s


    Set ExcelApp = GetObject(, "Excel.Application")


    Set cnnDB1 = New ADODB.Connection
   
    strDBPath = "C:\dati\mdb\Doku-ITA.mdb"

    With cnnDB1
        .Provider = "Microsoft.Jet.OLEDB.4.0"
        .Mode = adModeReadWrite 
        .Open strDBPath
    End With

    Set rstMOP_Detail = New ADODB.Recordset
    rstMOP_Detail.CursorType = adOpenKeyset
    rstMOP_Detail.LockType = adLockOptimistic
    rstMOP_Detail.Open "xxxx_MSProjekt_Task", cnnDB1, , , adCmdTable


    strMSProject = "C:\dati\dati"
    strDestMSProject = "C:\dati\dati"

    Set fs = CreateObject("Scripting.FileSystemObject") 

    If fs.FolderExists(strMSProject) Then
        Set f = fs.GetFolder(strMSProject)
        Set fc = f.Files

        For Each f1 In fc

            nOrderNumber = 1

            ' Create a connection to MS-Project-files
            Set cnnDB = New ADODB.Connection

cnnDB.ConnectionString = 
"Provider=Microsoft.Project.OLEDB.11.0;PROJECT NAME=" 
& strMSProject & "\" & f1.Name
           
            cnnDB.ConnectionTimeout = 30
            cnnDB.Open
            strSqlSel = "SELECT * FROM Tasks "
            PjtObjTsk.Open strSqlSel, cnnDB

            Do While Not PjtObjTsk.EOF

                ' Add a new detail-record on the access-database-table
                Add_xxxx_MSProjectTask

                ' Move to the next MS-Project-task
                PjtObjTsk.MoveNext
                
                ' increment the ordernumber
                nOrderNumber = nOrderNumber + 1

            Loop
            PjtObjTsk.Close
            cnnDB.Close
            If cnnDB.State <> 0 Then cnnDB.Close
            Set cnnDB = Nothing

        Next
    End If
    MsgBox " end "
    cnnDB1.Close
      
End Sub
'-----------------------
Sub Add_xxxx_MSProjectTask()

    ' Add an empty record to the table
    rstMOP_Detail.AddNew

    ' Fill the new record with values
    rstMOP_Detail!File = PjtObjTsk.Fields(0)
    rstMOP_Detail!SortNumber = nOrderNumber
    rstMOP_Detail!TaskUniqueID = PjtObjTsk.Fields(1)
    rstMOP_Detail!TaskPercentWorkComplete = PjtObjTsk.Fields(3)
    rstMOP_Detail!TaskDuration = PjtObjTsk.Fields(72)
    rstMOP_Detail!TaskBaselineFinish = PjtObjTsk.Fields(15)
    rstMOP_Detail!TaskBaselineStart = PjtObjTsk.Fields(16)
    rstMOP_Detail!TaskEarlyFinish = PjtObjTsk.Fields(104)
    rstMOP_Detail!TaskEarlyStart = PjtObjTsk.Fields(105)
    rstMOP_Detail!TaskFinish = PjtObjTsk.Fields(109)
    rstMOP_Detail!TaskPercentComplete = PjtObjTsk.Fields(2)
    rstMOP_Detail!TaskName = PjtObjTsk.Fields(191)
    rstMOP_Detail!TaskResourceNames = PjtObjTsk.Fields(262)
    rstMOP_Detail!TaskStart = PjtObjTsk.Fields(267)
    rstMOP_Detail!TaskText1 = PjtObjTsk.Fields(298)
    
    ' save the new reord
    rstMOP_Detail.Update
    
   
End Sub