excell vba
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Excell VBA

Excell VBA

resolvedResolved · Medium Priority · Version 2003

replyReply Fri 12 Jun 2009, 15:39Delegate Louise said...

Louise has attended:
Excel VBA Intro Intermediate course

Excell VBA

Is there simple code to link to Access from an Excell module?

For upcoming training course dates see: Pricing & availability

replyReply Tue 16 Jun 2009, 19:02Trainer Simon said...

RE: Excell VBA

Hi Louise,

Thank you for your question.

The code below should allow you to import data from an access table into excel.

Dim strExcelFile As String
Dim strWorksheet As String
Dim strDB As String
Dim strTable As String
Dim objDB As Database

strExcelFile = "E:\CSC\LDMS\LDMSDatabaseApp\LDMS_Spec.xls"
strWorksheet = "WorkSheet1"
strDB = "E:\CSC\LDMS\LDMSDatabaseApp\LDMS_IFF_APP.mdb"
strTable = "Test"

Set objDB = OpenDatabase(strDB)

'If excel file already exists, you can delete it here
If Dir(strExcelFile) <> "" Then Kill strExcelFile

objDB.Execute _
"SELECT * INTO [Excel 8.0;DATABASE=" & strExcelFile & _
"].[" & strWorksheet & "] FROM " & "[" & strTable & "]"
objDB.Close
Set objDB = Nothing

I hope this helps.

Regards

Simon

Tue 23 Jun 2009: Automatically marked as resolved.

 

Please browse our web site to find out more about
excel consultant and other Microsoft training courses.

Excel tip:

Transpose text

You can transpose any range of cells, turning the columns into rows and the rows into columns. Just follow these steps:

Select the range.

Click the Copy button on the Standard toolbar to copy it to the Clipboard.

Select a cell outside of the range you copied.

Select Paste Special from the Edit menu.

In the Paste Special dialog box, click Transpose, then OK.

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard