I
If
Hello,
I have the code below which opens a template Excel.
My Question :
After the opening of this template, I would like to use the
DoCmd.TransferSpreadsheet function.
I must use this function which prevents me errors.
I would thus like not to use a connection DAO.
Already thank you for your ideas and your assistance.
Yves
'----------------------------------------------------------------
Sub ExportQueriesToExcel()
Dim strTemplateDir As String
Dim strWorksheet As String
Dim strWorksheetPath As String
Dim strTemplatePath As String
Dim xlapp As Excel.Application
Dim xlBook As Excel.Workbooks
Dim xlSheet As Excel.Worksheet
Set xlapp = GetObject(, "Excel.Application")
strTemplatePath = xlapp.Application.TemplatesPath
strWorksheet = "Template.xlt"
strWorksheetPath = strTemplatePath & strWorksheet
Set xlBook = xlapp.Workbooks
'Open the workbook
xlBook.Add strWorksheetPath
End Sub
'----------------------------------------------------------------
I have the code below which opens a template Excel.
My Question :
After the opening of this template, I would like to use the
DoCmd.TransferSpreadsheet function.
I must use this function which prevents me errors.
I would thus like not to use a connection DAO.
Already thank you for your ideas and your assistance.
Yves
'----------------------------------------------------------------
Sub ExportQueriesToExcel()
Dim strTemplateDir As String
Dim strWorksheet As String
Dim strWorksheetPath As String
Dim strTemplatePath As String
Dim xlapp As Excel.Application
Dim xlBook As Excel.Workbooks
Dim xlSheet As Excel.Worksheet
Set xlapp = GetObject(, "Excel.Application")
strTemplatePath = xlapp.Application.TemplatesPath
strWorksheet = "Template.xlt"
strWorksheetPath = strTemplatePath & strWorksheet
Set xlBook = xlapp.Workbooks
'Open the workbook
xlBook.Add strWorksheetPath
End Sub
'----------------------------------------------------------------