Consulting

Results 1 to 9 of 9

Thread: Making VBA program more user friendly

  1. #1

    Making VBA program more user friendly

    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 ?
    Last edited by elbartje; 10-24-2017 at 11:05 AM.

  2. #2
    VBAX Expert Logit's Avatar
    Joined
    Sep 2016
    Posts
    613
    Location
    .
    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.

  3. #3
    Quote Originally Posted by Logit View Post
    .
    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.

  4. #4
    VBAX Expert Logit's Avatar
    Joined
    Sep 2016
    Posts
    613
    Location
    .
    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 ?

  5. #5
    VBAX Expert Logit's Avatar
    Joined
    Sep 2016
    Posts
    613
    Location
    .

    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.

  6. #6
    Ik denk dat je deze vraag beter in een Nederlandstalig forum kunt zetten.

  7. #7
    OK, thank you for your response

  8. #8
    VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    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.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  9. #9
    Quote Originally Posted by SamT View Post
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •