Using VBA can I access another computer's desktop that is on the same network as me? - vba

I finished a program for one of my colleagues but the final section of the program needs to start an executable file which is on a different PC. In this case the PC being used is called SYS1-PC and it needs to tell EDITING-PC that it should double click an executable file on its desktop.
I thought it might be something like this:
RDPWindow = Shell("C:\Users\FORMAT.PLIM\Desktop\testing.exe /v:" & "[IP ADDRESS]", 1)
But I just get file not found. Now I am not sure does that mean it has found the computer or does that mean it looked for that on my own C drive?
Cheers for any help

Related

VBA Code to point to BoxSync

I have a program that I need to run, which I have written it in VBA.
Currently I am pointing to folders in C: drive and our A drive.
This is all being structured and i need to run of Box Sync, this is however user account based.
Could anyone give me any pointers how to go about using Box Sync to point to?
Many thanks.
I have resolved this assigning variable to Environ("USERPROFILE") + hardocoding rest of the link.

VB.net: Is there a way to get the Printed File Path from Printform?

im working on my first big program. I will try to explain short how the important part of the program works, and then try to explain what my problem is.
My program is used by few people, they drive around the Europe and repair our machines. After the work, they start my program, and write a report. Until now the program was generating at the end 3 Files. (PDF file generated by printform, text file which contained the same information's again and the last file that was an Excel file, that one contained Data that was written inside the Datagridview.
These workers, used Email to send all 3 files separated. As you imagine, sometimes that can end bad, cause after work they are tired and sometimes they send the wrong files. So I made a upgrade, which gives the user a possibility to send the files directly from the Program, being sure everything is fine. In background I created a directory where 2 of 3 files always get saved. The problem is, while using printform, there opens a window where the user can select the path. And here start the troubles, some of the workers select different a different path, but then my program wont find the files again(its very important that are 3 files are together). I searched for something that would look like
dim printformpath as string = printform.getpath
is there something that works that way? I was searching but I didn't found anything helpful.
Thank you for understanding & help
Thanks, I added the path to the printFileName property and changed printform settings from Print to preview to print to file :)
Have a nice day

How can I determine which drive to save a text file on?

My problem is several (Windows) computers run from different drive letters (C drive, D drive, etc…) and I need to determine the one which the program is running on to save a TXT file of the history and bookmarks and some other stuff that is collected from the web browser that I designed. Visual Basic and C# code would be useful (VB preferred).
Use the function designed to get you the Windows-defined special folders, like this (untested):
Dim dirBrowserData As String = IO.Path.Combine( _
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), _
"YourBrowserName")
Putting user data on the root of whatever drive you're on is not recommended and may not be possible depending on security settings, but the local (non-roaming) user data should almost always be fine, because that's literally what that Windows API is there for.

Program recognizes a copy of itself in the operating system

I'm trying to create a piece of software that will not be susceptible to bots. Is there a way for me to code into a program a way to check in the operating system for a process just like it and then put in a shutdown mechanism if it is recognized. Think of something like netflix where if one tab in chrome is running netflix, a second tab being opened will display an "oops" message. Is there anything like this for something that does not run on a web browser? What should I be looking into?
Thanks in advance
There can be plenty of solutions; the first coming into my mind are:
1) your program checks for existence of a particular file; if the files is not found then the program continue, otherwise your programs know that another instance is running and thus can terminate immediately. If the file is not found, your program creates it and then delete it before exting.
2) you can use an operating system call or an o.s. utility program to know if another instance of your program is running (e.g.: in linux, the command ps)
have fun

Changing the location of an existing VBA Reference from C:\Windows\system32\ to a shared drive

I've been trying for a while now to get a reference file to be loaded externally to no avail.
To be specific I am trying to load a "Microsoft Date and Time Picker Control 6.0(SP4)" which usually resides in C:\Windows\System32\MSCOMCT2.OCX
However some people that run a macro containing this element don't have that "MSCOMCT2.OCX" file on their PCs so I thought I will move the MSCOMCT2.OCX to a shared location and reference the code to use the shared one instead (so everyone will have access to it)
I tried doing that but when I was trying to load a reference with "Browse" from a different location it didn't load it - because I already had that in C:..
So I thought OK... I will remove the file from C:\ so I can only reference the shared file. - so I deleted it.
So I open the workbook again and look at references - I cant find "Microsotft Windows Common Controls-2.6.0(SP4)" - great!
And I proceed to add it manually with Browse from the shared drive.
When I do that however 2 references of "Microsotft Windows Common Controls-2.6.0(SP4)" are being added - 1 from C:\(which is not there) and 1 from the shared drive.
The one from C:\ is always automatically selected.
If I try to disable the one from C:\ and enable the one from the shared drive it automatically changes back to what it was when i press OK.
If I try to enable both - it says duplicate References and keeps only the one from C:\
So.. does anybody know how can I get rid of that C:\ reference from the list so it doesn't get loaded? Apparently deleting the files themselves did not work.
Ultimately my goal is to enable people without C:\Windows\System32\MSCOMCT2.OCX file to be able to use my Date Picker Tool.
Thanks a lot!
ActiveX control rereferences are always GUID-based. The VB IDE shows you the current location of the file as listed in the registry on your computer, as a courtesy, but it really doesn't matter what it says. The control will be loaded from wherever it was registered on the user's computer.
That's the key: the control must be registered on the user's computer.
I must strongly discourage you from doing what you're trying to do. You might be able to concoct a method by which you load the DLL from a network location, but it presents no advantage over doing the Right Thing(TM), and plenty of problems. The Right Thing is simply that if you need that control, you must distribute and register it with your application, just like everybody else does. And you really should install it in the recommended location for it (System32); not on the network.
Here's a quick example of what can go wrong: you provide your user with you app, and it works with the control on the network like you want it. Then the user installs another application that happens to need the same control. The app's installer sees that the control is already registered on the user's computer, so it doesn't try to add it again. Except that this particular app is intended to be used when the user is not connected to a network. Now you just broke someone else's program.
The VB/VBA architecture was never intended to support XCOPY deployment. I'm know it's a pain and that these extra steps are extremely inconvenient when you're just trying to deploy a "macro". Sadly, it's the nature of the beast. I'm sorry