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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drag and drop to capture a 'Path'

Status
Not open for further replies.

solo7

Technical User
Mar 14, 2001
243
NO
I want my users to import several spreadsheets.

To do this I can code a module to import their spreadsheets, but I want them to drag and drop their shreadsheets onto a 'Form' which will then pass the 'path' to my module for automatic importing. So I can eliminate errors in the 'Path' statement.

Can some kind soul point me in the right direction.

solo7 [thumbsup2]
 
I don't know if that's possible, it probably is, but I don't know how;-) If it is the path that provides the challenge, wouldn't using some of the browse functions do? Application.FileDialog for 2002+ versions, or one of these functions BrowseFolder Dialog or Call the standard Windows File Open/Save dialog box, which should work on any version.

Roy-Vidar
 
RoyVidar,
Browse functions are ok, I'm just trying to make this user friendly for my 'Chimps' !! They can grasp the drag & drop principle but folder navigation scares them !!

Solo7 [thumbsup2]
 
This sounds pretty interesting...

I did a quick search on google..
drag and drop dll files

Here is a few links a came up with.

This looks like it will solve your problem


Here are a few more that looked interesting also.


Post back and let me know if you get this to work!

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Ok,
I bottled out of managing an 'ACCESS' drag and drop and went for a VB form which captured the path via drag and drop and then writes the resultant address to a table in my Db.

Whilst I do not like synchronising the two programs all is not too bad. On launching the .EXE the user drops the spreadsheet into my VB front end and this fires the SQL to write to the DB, the ACCESS prog is launched and the front end closes.

I now have a problem with the Spreadsheet as it seems to be locked - obviously by me either getting its location in the drag and drop in VB or by the Import in ACCESS.

ACCESS code for import
Code:
'---------- import the spreadsheet specifying the named sheet and pseudo range assuming zero values are not imported
'
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "TblTemp", StrXlsAddress, True, StrXlsSheet & "!A1:Z99"

VB6 code to get names of Worksheets
Code:
'---------- get the names of the sheets in the workbook
'
Dim xlobject As Object
Dim lngNumberOfSheets As Long
Dim i As Long
Dim strNameOfSheet As String

Set xlobject = CreateObject("Excel.Application")
Set xlobject = xlobject.Workbooks.Open(StrTemp)

lngNumberOfSheets = xlobject.Worksheets.Count 'number of sheets in a spreadsheet

'---------- populate the list box with the names of the spreadsheets 'sheets'
'
For i = 1 To lngNumberOfSheets
   strNameOfSheet = xlobject.Worksheets(i).Name 'name of sheet
   List1.AddItem strNameOfSheet
Next i

'---------- display sheet count
'
Label2.Caption = lngNumberOfSheets & " Sheets"

'---------- Populate the hidden label with the actual location of the spreadsheet
'
Label3.Caption = StrTemp

'---------- move focus
'
List1.SetFocus

'---------- lock text box so nobody can tamper with the address
'
Text1.Locked = True

'display new message in the label box
'
Label1.Caption = " Now choose from the list on the left, the spreadsheet you want to produce the ROA'S from"

Set xlobject = Nothing

Can anyone help?

solo7 [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top