Results 1 to 6 of 6

Thread: [VB.Net] Rename File to Program with Data in Excel

  1. #1
    Join Date
    Feb 2009
    Posts
    117

    [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)

  2. #2
    Join Date
    Dec 2008
    Posts
    112

    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.

  3. #3
    Join Date
    Feb 2009
    Posts
    117

    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?

  4. #4
    Join Date
    Dec 2008
    Posts
    112

    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?

  5. #5
    Join Date
    Feb 2009
    Posts
    117

    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?

  6. #6
    Join Date
    Dec 2008
    Posts
    112

    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

Similar Threads

  1. Replies: 4
    Last Post: 21-02-2012, 06:14 PM
  2. Replies: 3
    Last Post: 23-01-2011, 08:22 PM
  3. how to read data from file using c++ program?
    By Juaquine in forum Software Development
    Replies: 5
    Last Post: 27-02-2010, 06:02 PM
  4. How to write string data to file using java program?
    By Linoo in forum Software Development
    Replies: 5
    Last Post: 21-01-2010, 09:26 PM
  5. Cannot rename program file
    By Maximilian in forum Customize Desktop
    Replies: 3
    Last Post: 24-11-2008, 08:00 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,690,853.66097 seconds with 17 queries