Copy Filenames to a Clipboard

File hierarchies are becoming more complex and file paths longer as the capacity of hard drives increases. There are still many occasions, however, when you can’t browse to identify a file to be used?for example, when entering a constant in VB source. Normally, there is no alternative but to type in the path?this can be both tiresome and error-prone.

The solution: Create a new Standard EXE project, delete the default form (Form1), and add a module (Module1 by default). Type this code into Module1:

Sub Main()	Clipboard.SetText Command$End Sub

Under Project | Project Properties, set the Startup Object to Sub Main. Give the project a suitable name (for example, filename) and create the executable (in this case, filename.exe). Create a shortcut to the executable on your desktop. When the name of file is required, browse using Explorer or My Computer. Drag the file and drop it onto the filename shortcut. The full path of the file is now on the clipboard and you can paste it as necessary.

This works because dropping an object onto a program or its shortcut starts it with the name of the object in the command line. The program merely reads the command line and puts it onto the clipboard.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

iOS app development

The Future of iOS App Development: Trends to Watch

When it launched in 2008, the Apple App Store only had 500 apps available. By the first quarter of 2022, the store had about 2.18 million iOS-exclusive apps. Average monthly app releases for the platform reached 34,000 in the first half of 2022, indicating rapid growth in iOS app development.

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a