Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Storing data in MS Access from Excel VBA

I've been trying to store data from an Excel spreadsheet into an MS Access
table using Excel VBA Macro. I tried using the following macro. However, it
appears some of the functions I'm using are VB functions (e.g. OpenDatabase,
OpenRecordset, etc.) and may not be applicable in VBA. Also, the datatypes
Database and Recordset seem invalid in VBA. Is there a way to perform this
task using functions available in Excel VBA?

Would appreciate any help/pointers on this. Please cc me at
as well.

Thanks in advance.

Soumyo

--- Excel VBA Macro I'm trying to use -------


Sub StoreInDatabase()
NumberOfRows = Application.WorksheetFunction.CountA(Range("A:A"))
Dim dbsKeywords As Database
Dim rstKeywords As Recordset
Dim kwName As String
Dim activityDate As DateTime

Set dbsKeywords = OpenDatabase("WebMarketing.mdb")
Set rstKeywords = _
dbsKeywords.OpenRecordset("KeywordSummary", dbOpenDynaset)

For i = 2 To NumberOfRows

With rstKeywords
.AddNew
!Date = strFirst
!Keyword = strLast
!AvgPosition = Cells(i, 4)
!TotalImpressions = Cells(i, 5)
!TotalClicks = Cells(i, 6)
!AvgBid = Cells(i, 8)
!CPC = Cells(i, 10)
!Conversions = Cells(i, 11)

.Update
.Bookmark = .LastModified
End With

Next i

rstKeywords.Close
dbsKeywords.Close

End Sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing Data in Excel, using Excel to fill out pre-made Word docum WightCrow Excel Discussion (Misc queries) 0 March 19th 08 06:32 PM
Is Excel good for storing data that constantly updates? Lallo Excel Discussion (Misc queries) 2 December 15th 05 12:18 PM
Storing Excel Data in System Memory Shashi Bhosale Excel Programming 2 May 27th 05 05:21 PM
Storing Data in Access Database... Ernst Guckel[_4_] Excel Programming 5 April 9th 05 11:46 AM
Storing Cell Values in Access Mick Excel Programming 2 July 11th 04 09:34 AM


All times are GMT +1. The time now is 01:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"