Home > Software engineering >  For help! Urgent urgent... How to use VB to open computers excel at any position, and put the excel
For help! Urgent urgent... How to use VB to open computers excel at any position, and put the excel

Time:10-14

Good god:
I are writing a program that need to click a button, open the existing computer with VB some excel at any position, please pay attention to a great god, can't open the existence of a plate of a folder, need is a computer at any position can be, and then put the data in each cell in turn into an array, is very urgent, everybody to help genuflect is begged! Appreciate

CodePudding user response:

With the workbook. The open statement can open any position.xls files
As to the data into an array of cells, please refer to the following example:
 Sub test () 
Dim ww, a
Ww=Range (" a1: a16)
A=Application. WorksheetFunction. Transpose (ww)
The Debug. Print UBound (a), the Join (a, "*")
End Sub

CodePudding user response:

 
Private Sub CommandButton1_Click ()
Dim FLDR As FileDialog
The Set of FLDR=Application. FileDialog (msoFileDialogFilePicker)
Dim vSItem As the Variant
With FLDR
If the Show=1 Then
For Each vSItem In. SelectedItems
With GetObject (CreateObject (" Scripting. FileSystemObject "). The GetFileName (vSItem))
CRR=. Sheets (1). UsedRange 'put data in each cell of disposable time in an array
The Close (False)
End With
Next vSItem
The Else
End the If
End With
The Set of fd=Nothing
End Sub

CodePudding user response:

If a ShellExecute API/

CodePudding user response:

Computer anywhere is what meaning, is nothing more than the file system can realize the hard disk, usb flash drive, cd-rom, and network file?

Always not let program random search to open yourself?

Can't let the user to specify with CommonDialog?

CodePudding user response:

Processing the command line, hold down the shift key point the right mouse button on the excel file, choose open way, selection process, browse and find your exe program, check the always use the selected program to open this file, sure,
Just double click the left mouse button on the excel file, later will use your program to open the excel file,
  • Related