Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default I need a Macro

I need a Macro to dump certain cells in a worksheet into an access
database.

This will be done on a daily basis - I want them all on the same
database.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default I need a Macro

I'm doing the exact same thing right now actually.

i) Create a named range in excel over the range of cells you want
dumped into access. Lets call it 'EXPORT'.
ii) Open access. Create a linked table to your excel file and select
the range EXPORT.Call this linked table LINKED_EXPORT
iii) Create a Table in access with the same column headings as the ones
in the range EXPORT. This table will be blank for now. Call this table
TABLE_EXPORT
iv) Create an APPEND QUERY in Access. Append LINKED_EXPORT to
TABLE_EXPORT. Save the query as QUERY_EXPORT.
v) Create a Macro in access. Setwarnings = off, OpenQuery =
QUERY_EXPORT
vi) Put this into your vba code:

Sub EXPORT_DATA()

Dim mdb_Obj As Object
Set mdb_Obj = CreateObject("Access.Application")
Dim app As Application
Set app = Application
mdb_Obj.Visible = False

mdb_Obj.OpenCurrentDatabase ("c:\location\of\your\Database.mdb")
mdb_Obj.DoCmd.RunMacro "QUERY_EXPORT"
mdb_Obj.Quit

End Sub

Done:)

SmartyPants wrote:
I need a Macro to dump certain cells in a worksheet into an access
database.

This will be done on a daily basis - I want them all on the same
database.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default I need a Macro

Sorry - you'll need to save your macro as MACRO_EXPORT, then in the vba
code this line:

mdb_Obj.DoCmd.RunMacro "QUERY_EXPORT"

should read

mdb_Obj.DoCmd.RunMacro "MACRO_EXPORT"

Got ahead of myself :)

Fiddle with this as the basics are there. You do not necessarily have
to append new data to a table every time, but this is what I was doing
so it was easiest to explain.
-SD

S Davis wrote:
I'm doing the exact same thing right now actually.

i) Create a named range in excel over the range of cells you want
dumped into access. Lets call it 'EXPORT'.
ii) Open access. Create a linked table to your excel file and select
the range EXPORT.Call this linked table LINKED_EXPORT
iii) Create a Table in access with the same column headings as the ones
in the range EXPORT. This table will be blank for now. Call this table
TABLE_EXPORT
iv) Create an APPEND QUERY in Access. Append LINKED_EXPORT to
TABLE_EXPORT. Save the query as QUERY_EXPORT.
v) Create a Macro in access. Setwarnings = off, OpenQuery =
QUERY_EXPORT
vi) Put this into your vba code:

Sub EXPORT_DATA()

Dim mdb_Obj As Object
Set mdb_Obj = CreateObject("Access.Application")
Dim app As Application
Set app = Application
mdb_Obj.Visible = False

mdb_Obj.OpenCurrentDatabase ("c:\location\of\your\Database.mdb")
mdb_Obj.DoCmd.RunMacro "QUERY_EXPORT"
mdb_Obj.Quit

End Sub

Done:)

SmartyPants wrote:
I need a Macro to dump certain cells in a worksheet into an access
database.

This will be done on a daily basis - I want them all on the same
database.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default I need a Macro

http://www.erlandsendata.no/english/...badacexportdao

Hth,
Merjet

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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 04:02 PM.

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

About Us

"It's about Microsoft Excel"