[VB.Net] Rename File to Program with Data in Excel
Hello everyone, I have a small problem I'm trying to do a program to rename files in a folder under a sheet in excel itself where the first column contains the name of the file, the second with the new name which is to be renamed file ... In turn, I found many listings but no one really has worked for me. I wanted one for all and solve problems for all users ...
I thought for a window of the program very simple.
A first button to select the file in excel if not in the same folder.
A second button that allow me to select the folder that contains the files to rename.
A third button to start the program.
Exceptions:
if the program does not find a file that is present in the first column, in a txt file or in a window where you can copy paste ....
you say? (I am a newbie in the programming so):notworthy
Re: [VB.Net] Rename File to Program with Data in Excel
Well, you should at least demonstrate that you have tried ...
However, in VB is very simple interface for Office applications and manage the FileSystem.
Did I make a sample to 90% resolve your problem:
I have a file "Elenco.xls" in A1, A2, A3 contains 3 names of existing files (in my example are in dir "Files" located in the dir - relative path). In B1, B2, B3 I have names corresponding to change.
There are several ways to read from a file in VB Xls. Use the classic without trouble Ado:
-> Functions used by the main code:
Code:
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Integer, ByRef lpdwProcessId As IntPtr) As IntPtr
Private Function seFileEsiste (ByVal nomeCompFile As String) As Boolean
Dim F As New System.IO.FileInfo (nomeCompFile)
If Exists Then F.
seFileEsiste = True
Else
seFileEsiste = False
End If
End Function
And that's it.
Once again, the My NameSpace simplifies matters further.
Re: [VB.Net] Rename File to Program with Data in Excel
looks really a beginner it is more convenient for me just trying to solve a problem ... I tried but I had stopped to learn how to define the variables ... and from what you posted you understand that it was not for nothing that the right track ... Where did you learn?
Re: [VB.Net] Rename File to Program with Data in Excel
The only guide that is similar to the concept of "comprehensive" is the MSDN Library.
Finally, the web, in my opinion still the best "manual" of all ...
Think of this forum: is there a manual that answers the questions?
Re: [VB.Net] Rename File to Program with Data in Excel
Can you tell me how to refer to these libraries? how do I find these libraries?
Re: [VB.Net] Rename File to Program with Data in Excel
1. Open your project.
2nd Menu Project / Properties <project name> /
3rd Choose the tab "References" / Add Reference / COM ...
> Microsoft Excel 11.0 Object Library