How to run application automatically using scanner "honeywell" - barcode-scanner

This is my code that I use. Please correct me if I'm wrong. I just really want to learn as freshman student
My project is using barcode I need to use scanner to read the code at the same time automatically open the application set on that code
Private Sub Button1_Click(sender As Object, e As keyPressEventArgs)
Handle textbox1.keypress
If e.keypress=ChrW(15)Then
Textbox1.text=""
end if
End sub
Also I use
Process.Start("d:\windows\notepad.exe")
It works, but my target is automatically open without clicking any button
I'm still searching for next code. Any idea is very much appreciated 🙏
Thank you

Documentation: https://social.msdn.microsoft.com/Forums/vstudio/en-US/685e9790-2f16-4141-9c01-9d8030035414/using-vbnet-to-run-external-applications?forum=vbgeneral
But generally it's the following command
proc = Process.Start("d:\windows\notepad.exe", "")

Related

Passing in Parameters to Workbook_Activate from Command Line

I'm trying to keep alive an old Excel VBA program, and my client has asked me to run some existing code on startup (instead of having to click a button).
So, I'm following this tutorial here.
It kinda works ... ie when the excel files is open the MsgBox prompts appear but with blanks or 0s. However that only happens when I don't include the first line:
Declare Function GetCommandLineA Lib "Kernel32" () As String
when I include that, I get this error message:
Compile Error: Constants, fixed-length strings, arrays, user-defined types and Declare statements not allowed as Public members of object modules.
So - how do I do it?
The Sub Workbook_Activate is Private and I don't think I can change that, can I?
Posting for other confused people:
I was trying to run it from within the ThisWorkbook sub, and what Pᴇʜ rightly pointed out was that you have to create this code in a normal module, and then call that module's sub FROM the ThisWorkbook sub.
thank you Pᴇʜ

Excel VBA 7.1 comdlg

This is for VBA 7.1 excel's macro. I am trying to export a file to a location and it crashes at this part.
The error I am running into is "Can't find project or library". The reference not found is the "comDlg". I know this is a referencing error. However, I am unsure how to resolve it.
Private Sub cmdBrowse_Click()
comDlg.Filter = "XML Files"
comDlg.DialogTitle = "Save Export File As..."
comDlg.ShowSave
txtExportFile.Text = comDlg.Filename
I had the same issue with a UCase() function call, a simple VBA.UCase() solved it. If you need any more information please let me know. I believe this macro/excel sheet was made on an older version and carried over to a 64bit Windows 10.
You're trying to use VB6 controls that are unsupported in a 64-bit VBA host. Try a 32-bit Excel install, but consider using Application.GetSaveAsFileName/GetOpenFileName for this kind of thing:
Private Sub cmdBrowse_Click()
Dim promptResult As Variant
promptResult = Application.GetSaveAsFilename("file.xml", "XML Files (*.xml),*.xml", 1, "Save Export File As...")
If VarType(promptResult) = vbBoolean Then Exit Sub 'prompt was cancelled
txtExportFile.Text = CStr(promptResult)
End Sub
As for VBA failing to resolve the UCase function, ...wild things happen with broken project references: I'd expect these to just go away once the legacy 32-bit stuff is removed from the project.

Run AHK script from excel successfully

When trying to run a AHK script from excel the 1st way using shell
Sub FrmShell()
Shell ("C:\Program Files\AutoHotkey\AutoHotkey.exe \\REG-MITEK\Mitek\Mitek\documentation\RequestForQuote\old-RFP\RFP.exe")
End Sub
I get this error
When I run it with FollowHyperlink,
it works but can't get away from the dreaded hyperlink warning.
Sub FromHyperLink()
Dim s As String
s = "\\REG-MITEK\Mitek\Mitek\documentation\RequestForQuote\old-RFP\RFP.exe"
ThisWorkbook.FollowHyperlink (s)
End Sub
As per comment, posting an answer:
Check that statement - you're trying to open one application with another, as far as I know - the syntax should be "Application_path fileToOpen_path".
Possible decisions for #3 (requires registry access):
Circumvent Hyperlink Security Warning
and
here
But I didn't try neither.

Sharepoint and Excel VBA integration failure

I have encountered a problem when trying to retrieve file properties from SharePoint through VBA in Excel. (I can't post the workbook, but the below code should suffice).
The code in question:
Private Sub CheckCheckOutStatus()
Debug.Print Application.Workbooks.CanCheckOut("http://sp.mySharepointDomain.co.uk/myFolderPath/myFile.xlsb")
End Sub
The issue is that on my clients PC this statement always returns false regardless of whether the file is checked out or not (They are able to check out the file manually, so it isn't a file permissions issue).
Upon further investigation, it seems to be that my specific computer is able to get the correct value from this code and none other can. It's also worth mentioning that my client and all the PC's/Users I have tested this with are all on the same shared network and so we should all have the same packages installed.
Through process of elimination we have deduced that it is related to my specific computer (and it doesn't matter who logs into it, its the PC itself) that is able to use this method correctly.
My question is to all the experts out there:
Are there any client side or local packages/installations/permissions that could enable or disable programmatic access to the properties in SharePoint?
Thank you for taking the time to read this, and thanks in advance to any suggestions you might have!
I can't test this because I don't have SharePoint installed, but this looks about right...
Sub test()
Dim docCheckOut As String
docCheckOut = "Filepath&name"
Call UseCheckOut(docCheckOut)
End Sub
Sub UseCheckOut(docCheckOut As String)
' Determine if workbook can be checked out.
If Workbooks.CanCheckOut(docCheckOut) = True Then
Workbooks.CheckOut docCheckOut
Else
MsgBox "Unable to check out this document at this time."
End If
End Sub

User Exit EXIT_SAPLBARM_003

I am trying to use User Exit EXIT_SAPLBARM_003 however I cannot seem to get it activated.
In CMOD I created a project and added XMRM0001 as the Enhancement Assignment, by default the only components that I see is EXIT_SAPLBARM_001 and EXIT_SAPLBARM_003, but EXIT_SAPLBARM_002 and EXIT_SAPLBARM_004 are missing.
link to image broken
I realize in the picture the User Exit is not active, but that's because I am trying to add EXIT_SAPLBARM_003.
Any tips would be greatly appreciated as always.
Thanks!
You can modify the User Exit on SMOD and add the Function Module.
Att.

Resources