Is is possible to generate a workbook for each record in a recordset, and title it using the unique identifier for that record?
I created the following code, but it does not seem to work. First of all it doesnt like the string and secondly it does not like the declaration of wb as Excel.Application
any thoughts or better approaches?
I created the following code, but it does not seem to work. First of all it doesnt like the string and secondly it does not like the declaration of wb as Excel.Application
any thoughts or better approaches?
Code:
Private Sub generate_wkbk()
Dim rsID As DAO.Recordset
Set rsID = CurrentDb.OpenRecordset("Select * FROM tblMeeeting;", dbOpenDynaset)
With rsID
rsID.MoveFirst
Do Until rsID.EOF
Dim filepath As String
Set filepath = "\Desktop\test\Data_for_Meeting_#" & rsID!Meeting_ID & ".xls"
Dim wb As Excel.Application
Dim mywb As Excel.Workbook
Set wb = CreateObject("Excel.Application")
Set mywb = GetObject(filepath)
Loop
End With
rsID.Close
Set rsID = Nothing
End Sub