Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



VB script or code to open copy and paste in file

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 18-06-2012
Member
 
Join Date: Apr 2012
Posts: 33
VB script or code to open copy and paste in file
  

First of all let me know whether what I have asked is possible or not? I am not well aware of VB Script; you can take me as a new entry to this language. I need to learn some coding in VB script for opening a file then coping data from it and then pasting it completely. Everything should be performed automatically using scripting code. The data copy pasting should be performed between two file. Data should be opened in a file then copied and pasted onto another file and then also the file should be saved with a new name. Trust me as I already said that I am not well aware of VB script so therefore I am also unable to make out whether it is really easy and possible to perform. Anyways its on you people to guide and help me further.

Reply With Quote
  #2  
Old 18-06-2012
Member
 
Join Date: Apr 2009
Posts: 481
Re: VB script or code to open copy and paste in file

Depends on what format of files you are trying to involve in the task. I mean to say that if you are trying to perform the manipulation of the data of a complex then it would have been quite impossible but if you are involving a text file rather than any other file then I must say you can easily achieve your target.

Anyways if in case you are really trying your hands with text file then the only thing I would suggest you is to start with filesystemobject. This filesystemobject search only work with text files. Another thing I would like to tell you that copy a data or a program in order to transfer them from one file to another would be much easier with a Copy Program only if you need your script to be able to call other programs.
Reply With Quote
  #3  
Old 19-06-2012
Member
 
Join Date: May 2009
Posts: 531
Re: VB script or code to open copy and paste in file

In a simple language the above person means to say that in such programs the codes are written on the basis of the file format. Copy Program is a good option I must say. This program is something that will have to undertake within the batch file or a command line for copying the file. The syntax you could use is Copy Source Destination. Using a VB Script code you can do it in the following manner:

set WSshell = createobject("wscript.shell")
WSshell.run("copy c:\foldername\filename.txt c:\folder2name\file2name.txt",1)

Just try this out and let me know the result.
Reply With Quote
  #4  
Old 19-06-2012
Member
 
Join Date: Mar 2010
Posts: 153
Re: VB script or code to open copy and paste in file

Using a Shell initially game me some errors. Obviously the errors are not at all understandable by me. The error message also produces some error code. I have tried running the following code:
Shell "notepad.exe c:\foldername\filename.txt", vbMaximizedFocus

Later on found that I followed the code wrongly. Actually the syntax belonged to Visual Basic Application. Then however after a long research I got the correct code for VB script. It was as follows:
set WSshell = createobject("wscript.shell")
WSshell.run("notepad.exe c:\foldername\filename.txt", 1)
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "VB script or code to open copy and paste in file"
Thread Thread Starter Forum Replies Last Post
How to copy paste file in Micromax Funbook Ogan Portable Devices 3 12-07-2012 06:13 PM
I cannot do Copy and Paste or Paste Special between Excel Workbooks Acca-OR Windows Software 5 26-04-2012 04:16 AM
Excel file corrupted because of copy paste between files RopeME MS Office Support 2 25-01-2012 03:52 PM
How to bypass the open file security warning in vb script Quasim Software Development 5 05-07-2011 07:27 PM
Copy Text from One Cell to Another in Microsoft Excel without copy & paste Computer_Freak Tips & Tweaks 0 18-03-2009 10:00 PM


All times are GMT +5.5. The time now is 10:05 AM.