PDA

View Full Version : Making VBA program more user friendly



elbartje
10-24-2017, 10:49 AM
I want to make a program and it should do the following:
Read a .txt file and check some characters in it. If it contains the correct characters copy the file to a new location. Else give an error.


I can program this in excel visual basic but this is not as user friendly as I would want to (opening excel, browse to the file, ...).
I want this program easier to use, for example:
Dragging a .txt file on a desktop icon which triggers the code or right click on a .txt file and an option should popup to start the code.


Is there a way to do this with VBA, or do I have to learne an other programming language.
Can I (re)use my VBA code ?

Logit
10-24-2017, 01:25 PM
.
I don't know about 'drag and drop' but you can create a macro attached to a command button that will accomplish the task.
About as user friendly as you can get ... just click and go.

elbartje
10-24-2017, 01:52 PM
.
I don't know about 'drag and drop' but you can create a macro attached to a command button that will accomplish the task.
About as user friendly as you can get ... just click and go.

The problem is that the user has to open an excel file first.

Logit
10-24-2017, 05:21 PM
.
Will the term being search for in the txt file always be the same ? Can it be "hard coded" into the macro ?

Will the folder where the txt file is moved to always be the same ? Can it be "hard coded" into the macro ?

Logit
10-25-2017, 05:57 AM
.

Basically, you are wanting to create an ICON on the desktop that the user can drag/drop a TEXT FILE link on, then have the process evolve.

After some extensive searching last night, it appears your best bet for 'drag and drop' as you are describing would be the C Language or something similar. Excel doesn't appear capable of
providing what you seek.

Excel should be able to accomplish your goal if you are willing to accept the COMMAND BUTTON approach and perhaps some other interaction with the user.

snb
10-25-2017, 06:45 AM
Ik denk dat je deze vraag beter in een Nederlandstalig forum kunt zetten.

elbartje
10-25-2017, 01:21 PM
OK, thank you for your response

SamT
10-25-2017, 02:35 PM
Dragging a .txt file on a desktop icon

Assuming that you're using Excel to open and check the .txt file

PLace your Excel Workbook file in a folder.
Create a shortcut to the Excel file, then move it to the desktop. Rename the Shortcut. Give it a new Icon.

When the User Drops a text file on the shortcut, Excel will run and open that file. Whether Excel is visible, etc is up to you.

A Command.Com Commnd can be done as a shortcut to do the same thing. The CC Shortcut is more elegant, IMO.

elbartje
10-26-2017, 09:36 AM
When the User Drops a text file on the shortcut, Excel will run and open that file.

This is exactly what I want, but excel does not launch when I drop a .txt file, or am I missing something ?

I wil look later into the Command.Com solution.