![]() ![]() Thanks! Kelvin 1.-Shell-API-open-file-with-default. Just declare de API header and you can 'call' a file directly to open it in associated application. which it did, but nothing else happened when I clicked the UserForm. Open 'D:test.txt' For Input As 1 Read the file Close Open 'D:test.txt' For output As 1 Write to the file Close 1 Open 'D:test1.txt For Input As 1 Open 'D:test2.txt For Input As 2 Read 2 files Close 1, 2 VBA Coding Made Easy Stop searching for VBA code online. You can use the ShellExecute VB function. I ran Userform1 from a standard code module: UserForm1.Show. Thinking 'YES' I created UserForm1 and put the API code in the UserForm code sheet. does that mean that 'Form1' at the end of step-by-step is in fact UserForm1? Tim Williams at 0:56 erlandsendata.no/english/index. ![]() The procedure starts from Private Sub Form_Click() which looks like a click event for a userForm. You can use Shell () to open any document in its default application (assuming there's an existing file type association for that kind of file). Form1 is created by default.Īdd the following code to the General Declarations section of Form1: ' I have a folder set up that the user can add and remove exel files as they please. The Windows API ShellExecute() function is different from the Visual Basic Shell() function in that you can pass the ShellExecute() function the name of a document and it will launch the associated application, and then pass the filename to the application. Open a file by selecting it in a Listbox in a Userform strebs369 S strebs369 New Member Joined Messages 39 1 I have an issue for anyone that can answer. If theyre OK then can you open the VBA Editor in this blank. The following example demonstrates how to start an application or load a document into its associated application. Go to File > Options > Trust Center > Macro Settings and check your settings there.
0 Comments
Leave a Reply. |