Hey All,
Actually I need to export the data from Access to Excel particular spreadsheet(ie.Raw Data),so I was using Docmd.Transferspreadsheet but in this syntax where i can give the spreadsheet name.
Example:
I have a Excelfile name is Inventory.xls,and sheet name is 'Raw Data',so i need Access data should export to Inventory Excel file Raw Data sheet.
I tried like this:'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Inventory_Acc", "C:\Inventory.xls", True
So where I have to mention the Sheet name.Above format only exports the data to Excelfile.
Please help on this.
Thanks,
Phani
3 4487
Hey All,
Actually I need to export the data from Access to Excel particular spreadsheet(ie.Raw Data),so I was using Docmd.Transferspreadsheet but in this syntax where i can give the spreadsheet name.
Example:
I have a Excelfile name is Inventory.xls,and sheet name is 'Raw Data',so i need Access data should export to Inventory Excel file Raw Data sheet.
I tried like this:'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Inventory_Acc", "C:\Inventory.xls", True
So where I have to mention the Sheet name.Above format only exports the data to Excelfile.
Please help on this.
Thanks,
Phani
This should work for you
J -
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Inventory_Acc", "C:\Inventory.xls", True, "Raw Data"
-
This should work for you
J -
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Inventory_Acc", "C:\Inventory.xls", True, "Raw Data"
-
Hi
Thanks for reply,but this one not working iam getting error as "The Microsoft Jet Engine could not found the object "Raw Data".So could please help on this..
Thanks,
Anil
Hey All,
Actually I need to export the data from Access to Excel particular spreadsheet(ie.Raw Data),so I was using Docmd.Transferspreadsheet but in this syntax where i can give the spreadsheet name.
Example:
I have a Excelfile name is Inventory.xls,and sheet name is 'Raw Data',so i need Access data should export to Inventory Excel file Raw Data sheet.
I tried like this:'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Inventory_Acc", "C:\Inventory.xls", True
So where I have to mention the Sheet name.Above format only exports the data to Excelfile.
Please help on this.
Thanks,
Phani
Give this a try -
Function ExportToExcel()
-
Dim xl As Excel.Application
-
Dim wkbk As Excel.Workbook
-
Dim sht As Excel.Worksheet, rng As Excel.Range
-
Dim db As DAO.DataBase, rs As DAO.Recordset
-
Set db = CurrentDb
-
Set rs = db.OpenRecordset("Select * from YourSource;") '<--Your Table or Query here
-
Set xl = CreateObject("Excel.Application")
-
Set wkbk = xl.Workbooks.Open("C:\YourSpreadsheet.xls") '<--Your Excel File Here
-
xl.Visible = True
-
Set sht = wkbk.Sheets("YourSheet") '<--Your Sheet Here
-
With sht
-
.Range("A1").CopyFromRecordset rs '<--start at any range you want here
-
End With
-
rs.Close
-
wkbk.Close (True)
-
xl.Quit
-
Set xl = Nothing
-
End Function
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: mcnewsxp |
last post by:
how can i specify a particular worksheet using the docmd
transferspreadsheet?
thanks,
mcnewsxp
|
by: O'Donnell Tribunal |
last post by:
Hello Everybody,
I am using the TransferSpreadsheet method to import spreadsheets for
processing.
say my code looks like this:
DoCmd.TransferSpreadsheet acImport, 0, _
"tbltempImport1", ""...
|
by: JMCN |
last post by:
hello
i have your basic select case question. i created a combo box and save
it as a query. so whenever the user selects the value and clicks the
export button, the select case should then export...
|
by: user_5701 |
last post by:
Hello, I'm getting an error with a Docmd.Transferspreadsheet line of
code:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel2000,
"tblTest", pathAndFilename, True
The above line...
|
by: Gary Cobden |
last post by:
I have a problem with the following code, which leaves an instance of
Excel visible in Task Manager.
By a process of elimination I have got it down to the fact that
something in the...
|
by: Randy Harris |
last post by:
I've run into a nasty problem, can't find a way around it.
This line of code:
DoCmd.OutputTo acOutputTable, "GSQ_Criteria", acFormatXLS, FileName
errors with
#2385 - Errors were...
|
by: aleksandra_83 |
last post by:
Hello,
I have searched all over google groups and internet, but I have not
found a solution to this problem that has worked. The solutions I found
helped me single out the line that is causing...
|
by: Tom Louchbaum |
last post by:
I try to use this command to import a spreadsheet
"DoCmd.TransferSpreadsheet acImport, 8, tablename & " -tbl", DIR &
"Book2.xls", True"
and it errors out. If I try to import that same...
|
by: JHNielson |
last post by:
I am having quite the unique problem trying to Export to Excel and I need ot find a solution within 3 hours. -- PLEASE HELP!
The system exports a file from the application that the users can make...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |