LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 152
Default Import Dbase data Using VBA

Hi,

It got to this line "Col2Write = Trim(CStr(MyCell.Col + ColOffset))" and
stalled with error "object doesnt support this method or property"

I'm relatively new to vba

Could you advise further ?

Alan

"Nicholas B" wrote:

Sorry

There's another option
Excel can read DBF's directly as long as there are less records than rows in
Excel
So you could open the file and read in the data then transfer it toi where
you want it

This is just iffy code not totally correct syntax ... just to give you
starting points

OriginalWB = ActiveWorkBook.Name
OriginalSht = ActiveSheet.Name

RowOffset = 10 ' Set to something that works for the location of your data
ColOffset = 10 ' Set to something that works for the location of your data
ListofCols = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

Application.WorkBooks.Open("C:\YourDataFolder\Your DBF.DBF")
FOR EACH MyCell in Activesheet.Cells
Row2Write = Trim(CStr(MyCell.Row+RowOffset))
Col2Write = Trim(CStr(MyCell.Col+ColOffset))
Cell2Write = MID(ListofCols,Col2Write,1)+Trim(STR(Row2Write))

IF MyCell.Row1 then ' The field headers are in row 1
IF MyCell.Column = 1 then
WorkBooks(OriginalWB).Sheets(OriginalSht).Range(Ce ll2Write).Formula
= MyCell.Value
ENDIF
IF MyCell.Column = 2 then
WorkBooks(OriginalWB).Sheets(OriginalSht).Range(Ce ll2Write).Formula
= MyCell.Value
ENDIF
ENDIF
NEXT MyCell


Well that sort of approach !

Good luck

Nick

"Alan" wrote:

Hi,

Im looking for some vba code that I could apply to a button, which when
clicked, will then import specific tables from a dbase file, starting at a
specific cell on Excel spreadsheet.

Appreciate any advice you can give €“ Thanks

Alan.

 
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
How to Start Excel in Text Import Wizard for data import rlelvis Setting up and Configuration of Excel 0 July 10th 08 08:40 PM
PLEASE!! How can I un-grey the 'Data-Import External Data-Import Data' option ??? kirkm[_6_] Excel Programming 13 August 8th 06 10:01 AM
autofill data from excell dbase into html form offline? Robin Hood Excel Programming 2 November 13th 05 08:29 PM
Excel VBA & ADO - retreiving data from Approach dBase IV .dbf files EddyT Excel Programming 1 May 14th 04 03:27 PM
sending data to an MS-SQL dbase Kamal Hussain[_2_] Excel Programming 1 March 5th 04 03:54 PM


All times are GMT +1. The time now is 07:01 AM.

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"