Replacing the default File copy Dialog - vb.net

i'm trying to replace the default file copy dialog with my own program, which I want to create with vb.net.
My problem:
Where can I enter my application path to start automatically (and parse arguments/paths) when the user copies and/or pastes files?
Thanks in advance!

In order to monitor a file path I would suggest using FileSystemWatcher Class. This will monitor a folder for any files that are copied and pasted to the location. There is a great example at the below link.
https://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher(v=vs.110).aspx

Related

Excel on Mac. Cannot open IQY file in Data/Get External Data/Run Web Query

I am running Excel version 16.45 on Mac.
I have created a .iqy and saved it in the Queries directory alongside certain templates which were already there.
I go to Data/Get External Data/Run Web Queries. While the templates are accessible, my file is visible but greyed out (same thing happens if I save the file in a different directory).
Would anyone be able to help?
According to your information, I would like to confirm whether the issue occurs when you follow the steps as below:
1.Create a Word file, paste the web URL.
2.Save the Word as .iqy with .txt format.
3.Choose MS-DOS as coding.
4.Create an Excel file and click "Data >Get External Data >Run Web Query (Or Run Saved Query) " of the Bar
I was able to address the issue as follows.
When navigating to the relevant directory with Finder, the '.iqy' file appears to be appropriately named (as per Image 1).
In fact, if you reach the file in Terminal, the file is saved as '.iqy.txt'.
So all I had to do is rename the file, simply removing the '.txt' string at the end.
Screen you see when navigating in Finder

change of location of the database dynamically in app running

Try to make my app read the ms-access database from shortcut of my database it failed to read, so try to change the location of database dynamically ( there is an option in the app to move the database to drop-box folder and create a shortcut to that database in app folder )
try to make an shortcut to the moved ms-database
the app to read the database or to change the location of database dynamically
First of all, you should create a folder with a clear name in your VB.Net application path, namely inside the project Debug folder, let's name that folder as "MyProjFiles", so it will be in this path: ProjectFolderName\bin\Debug\MyProjFiles
Put your whole projects files inside our lovely folder MyProjFiles, including all types of your attachments: database, images, sounds, files, etc.
Call your database or whatever of those attachments files in addition to our \MyProjFiles\ using this method: My.Computer.FileSystem.CurrentDirectory & "\MyProjFiles\YourFilesPathHere.EXT".
Now, the whole path will be such as this string: "C:\CurrentUserNam\RootFolder\ProjectFolderName\bin\Debug\MyProjFiles\YourFilesPathHere.EXT"
For great practical example of this, supposuply let's open our MSAccessDB.accdb which is already copied into our project folder \MyProjFiles\ by this code directly:
System.Diagnostics.Process.Start(My.Computer.FileSystem.CurrentDirectory() & "\MyProjFiles\MSAccessDB.accdb")
The result will be simply opening our database which called "MSAccessDB.accdb"
Or open some pdf files such as this line:
System.Diagnostics.Process.Start(My.Computer.FileSystem.CurrentDirector() & "\MyProjFiles\MyPdfFile.pdf")
and so on.
I hope this can help you all brothers.
Best ^_^ Regards.
You should read this link.
It explains how to read the information you need to give the access Datareader something to do.
.NET read binary contents of .lnk file
Maybe this is enough, so you don't need to copy anything.

Print button didn't save the PDF file at a shared path, and no error logged

I have an Excel macro that uses SAP for printing data in pdf format.
Steps:
it access the SAP transaction which provides a table with the necessary information
it press Print button (from the Menu Bar of SAP)
then Print window appears (from here it is selected Microsoft Print To PDF option and then it is pressed OK button)
Save As window appears (complete the path and filename: \S\BC....\outputName)
then Save button it is pressed
then no error happens
But if I access the path folder "\S\BC....", nothing happen, there is no file saved. BUT, if we look in "Date modified" property of the folder, it is modified in accordance with the last saving time.
Also, I mention that if I'm trying to write the pdf file on local folders, not network shared folders (example: a desktop folder: C:\Users\mariah\Test), macro works.
Also, I mention that user can Read&Write at the shared path \S\BC....\
Please help me to find the cause of this issue.
A VBA macro only does what you are allowed to do manually. Can you manually save the file in the shared path without the macro?
Is the common path really \S\BC...\ or \ \S\BC...\ ?
Regards,
ScriptMan
Solution proposed by the OP in this comment:
IT WORKS if I save the file on "C:\Users\UserName" and then cut it to shared path "S\BC...". So I've implemented code that saves the file in a path and then copy it to another path and then I deleted it from the first path (such that user never knows that I copy the file in other destination than desired destination).

Adding an image to a solution which won't compile and which can be navigated to

It often happens that I draw diagrams of how something is designed in my application, for example a tree-like structure in a dialog window with several steps that the user can answer by choosing yes and no.
Is it possible to include this image in my solution but not compile it?
And would it be possible to add a link to the image in my code so that I can simply click on the link, and it would open up the image for me in VS?
This way I wouldn't have to locate it on my disk.
Thank you very much!
If you want to add an existing file to your project then right-click on your project in the Solution Explorer and select 'Add > Existing item'. Set the Build Action to Content and the Copy to output directory to Copy always or Copy if newer. The file will then be copied to the same folder as the EXE when you build. You can access such a file at run time using a path like this:
Dim filePath = IO.Path.Combine(Application.StartupPath, "filename.ext")

How to Create VBA Add-In with Shared Codes for All Excels?

I'm writing VBA codes for multiple Excel spreadsheets, which will be shared with others from time to time. At some point I find there are lots of duplications in my works. So I want to find a way to share codes in a sort of Excel add-in, like the .xla file.
But when I tried to save the Excel file containing shared codes as .xla file, I got some problems:
The file cannot be edit anymore after I save it in the default add-in folder
If I move the .xls file to a folder other than the add-in folder, and open it directly - I cannot use its classes - which creates problems for sharing the codes
Any ideas to create add-ins in a flexible and powerful way please?
Thanks a lot for the help
Not completely sure this is what you're looking for, but ...
(1) save the .xla/.xlam code by clicking the save icon in the VBA editor. HOWEVER, the thing that saves is the thing currently selected in the Project Explorer pane, which lists all open VB Projects and which is usually on the left. Even if you are staring at your just-edited VBA code, clicking the save icon will not save your code unless it is also selected in the Project Explorer pane. You won't get feedback that anything was saved - but you can verify by checking the file timestamp in a separate window.
(2) if you have an *.xls file which (via the formula bar) refers to VBA functions from your *.xla / *.xlam file, then if you open the *.xls file without opening the .xla,.xlam file first, Excel may create external links to resolve the formulas (i.e. referring to a file which is not open). If you have moved or renamed the *.xla file you can get stuck with those "mangled formulas" and need to edit out the pathname links that Excel inserted using a global substitute. If you arrange to open the .xla,.xlam prior to any *.xls file that uses it, you shouldn't have a problem (e.g. by using the default folder).