Export Query to Excel

  • Thread starter Thread starter Christian
  • Start date Start date
C

Christian

Hi NG,

I'm using this VBA below (I found it from another post) to export an query
to excel format.
I use Win2000, Excel 2000 and Access 2000.

Everything works out as expected, only problem is that all text fields in
Excel are getting a 'sign in front of the text.
Is there any possibility to avoid the ' sign?
- Chr

'Public Sub MoveQueryToExcel()

Dim MyXL As Object
Dim xlwk As Excel.Workbook

'this is to close the spreadsheet, if it is open
Set MyXL = CreateObject("Excel.application")
Set xlwk = GetObject("C:\Users\reset_graph.xls")
xlwk.Close
Set xlwk = Nothing

'this is to send the query over
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"QryReportPlain", _
"C:\users\reset_graph.xls"

'this is to open Excel and the spreadsheet again
MyXL.Visible = True
MyXL.Workbooks.Open "C:\Users\reset_graph.xls"

End Sub
 
Christian said:
export an query
to excel format.
Everything works out as expected, only problem is that all text fields in
Excel are getting a 'sign in front of the text.
Is there any possibility to avoid the ' sign?

I'd be interested to hear what problems the ' sign is causing you.

Many thanks,
Jamie.

--
 
Hi Jamie,

Doesn't cause me any problem, so I just left as it is.
But first I was affraid the ' sign would be visible in Excel Pivot tables,
autofilters etc.

But as the other person wrote in the link provided it just ensures that text
entries are managed like text and not numbers. Which is a good thing.

Br
- Chr
 
Back
Top