Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transferspreadsheet Method

Status
Not open for further replies.

Striper

Technical User
Jun 25, 2002
1
US
Rather than hardcode the filename into the filename argument of the Transferspreadsheet method, I would like to have the User enter the path. How can this be accomplished?
 
You need to use a variable:

Dim strFileName As String
strFileName = InputBox("Enter the full path and file name of your excel spreadsheet.")
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel97, "tblExcel", strFileName, True

this code creates a variable called strFilename
It asks the user to enter a path and filename and stores the answer in the variable.
the transferspreadsheet method then uses what is stored in strFilename as an argument.

HTH

B ----------------------------------
Ben O'Hara
bo104@westyorkshire.pnn.police.uk
----------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top