TransferSpreadsheet Function

Carl1

New Member
Joined
Aug 16, 2005
Messages
7
Help. I am not a particularly sophisticated Access person but have a basic understanding of Macros and have a slight problem with a Macro within Access.

I am trying to Import data (Will always be in same field layout - but in Excel) into an existing table (With Same Field Format - But in Access) and append this data to the table.

I have had some success using the TransferSpreadsheet function doing this but as I use Macros I have to set-up at the start the filename for the Excel File.
Is there a way that I can change this filename, so it looks at a different file each time (Will always be the same format)?

Ideally I would like to be able to just run the macro - and browse/search and dble click the actual file I want appending at that time.

Hope someone can help

Carl :(
 
Carl

There is the Name statement, which can be used in VBA.

Check the help file for the exact syntax.

Code:
Name "MyFile.xls" As "MyNewFile.old"

'populating' basically means adding items to the listbox, which you are doing with the AddItem method here.
Code:
Me.FileList.AddItem varFile
 
Upvote 0

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Norie

Cheers

As it is Ive gone for the more drastic option and deleted the file once imported, using the Kill function.

Cheers for all your help.

Carl :biggrin:
 
Upvote 0
Why not use FILECOPY?

Alternatively - you could always generate a log of successful imports and check during all imports so you don't duplicate anything. (compare names)

Mike
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,818
Members
449,049
Latest member
cybersurfer5000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top