Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




How To Copy Paste Files


Hi, I would like some help on a task for my program.
I need to find out how to copy an existing photo from a folder and paste it in an other folder.
I know how to rename a file (Name App.Path & "" & "Tmp.jpg" As App.Path & "Folder" & "tmpCopy.jpg"),
but I can't figure out how to copy paste them so than the original stays at it's place.
Thankx for the help.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Copy / Paste Files
Hi,

is it possible to copy a file into another file?

i have a file which i want to copy, then delete then paste into another new file which is made with some new data. can this be done?

im not using the fso im just using c:file.dat

Simon.

Copy Paste Files..
How do i use Copy paset comands how wold the script look like if...So when click or forum unload load...Copy a file it the same folder as the exe and then paste it to i destination..(C:bla/)...And the rename it to another name..
Like Copy app.path /bleh.ini
Paste C:/Programfiles/blehaaa/BELHing.dll
So it changes name alwso....

Copy-paste Files
Hi,

How to copy file(s) to window's clipboard and paste them back to specified folder.

Thanks.

How Can You Copy And Paste Files?
filburt: I thought you post was pretty cool. I was under the impression that Name was only used to Rename stuff. Anyway, I tried it, with some interesting results.
VB Code:
'this worked fineName "c: ext.txt" As "c:asp ext.txt"'this gave me a file not found errorName "c: ext.txt" As "c:asputil ext.txt"
It seems if the destination is more than one folder deep, this has major heartburn. ?

Copy And Paste Files
hi, i need to be able to copy any sort of file from one folder and place it into another folder. These files might be .txt, .doc .... anything

Also i need to be able to check if the folder i am copying to exists, if it doesnt then i need to create the folder

i would appreciate any help with this

thanks

Copy And Paste A List Of Files
I'm loading a list of files and tryin to copy selected, un-selected, or all files from the list to a new subdirectory. cant get it to work.. here is what I've got so far... using listbox style=checkbox


Code:
Private Sub cmdNameNew_Click()

Dim fso
Dim strFile As String
Dim NewFileDir As String
Dim FileDir As String
Dim Create As String

Create = txtNameNew.Text
FileDir = "C:Documents and SettingsOwnerMy DocumentsBrainDeadMapCollection"
NewFileDir = "C:Documents and SettingsOwnerMy DocumentsBrainDead"

MkDir NewFileDir & Create

For i = frmMain.lstNew.ListCount - 1 To 0 Step -1
If frmMain.lstNew.Selected(i) = True Then
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(FileDir & frmMain.lstMaps.Selected(i) & ".bms") Then
FileCopy FileDir & frmMain.lstNew.List(i), NewFileDir & Create
MsgBox "Map List Created", vbInformation, "Notice"
Else
MsgBox "The file you are trying to copy does not exist.", vbCritical, "Error"
End If

End If

Next i

If txtNameNew.Text = "" Then
MsgBox "You Have Not Named Your List Yet", vbCritical, "Error"
End If

End Sub

Copy-paste New Application Files
I make changes on my program very often so after I change something in application I have to go from PC to PC and copy paste new .exe file or .dll

I was thinking on this way but I do not know how I can make it;

Can I make on every PC that shortcut of my application actually always call one VB Script or .exe. Script will do this; go to one location on the server and if find any file on that location copy them and paste locally on PC.

In this case I do not need to walk around and copy-paste files every time I make any change in application.


Does anybody have idea or example of vb script, or vb code how I can make it.



Thanks,

Ilimax

Copy, Cut And Paste Wrecks Files
Hi,

I have an integral editor in my application and having trouble with the copy, cut and paste routine. I suspect the problem occurs when the file is opened for edit but I do not know that to be fact. Below I have shown the code that I suspect is causing the problem and below that is a sample of the code showing the problem.

Servo

Dim iFile As Integer, tempstring As Long, templine As String

Open txt_FileName For Input As iFile
Do While Not EOF(1)
Line Input #iFile, templine
 tempstring = tempstring + templine + Chr(13) + Chr(10)
Loop
Close #iFile


N4189 X-3.09 Y-.6631 Z1.0334
N4190 X-3.12 Y-.655 Z1.0386
N4191 X-3.15 Y-.6468 Z1.0437 N4192 X-3.18 Y-.6386
Z1.0488
N4193 X-3.21 Y-.6304 Z1.0537
N4194 X-3.24 Y-.6221 Z1.0587
N4195 X-3.27 Y-.6137 Z1.0635

N4196 X-3.3 Y-.6053 Z1.0683
N4197 X-3.33 Y-.5969 Z1.073
N4198 X-3.36 Y-.5885 Z1.0777
N4199 X-3.39 Y-.58 Z1.0823
N4200 X-3.42 Y-.5714 Z1.0868


N4201 X-3.45 Y-.5629 Z1.0913
N4202 X-3.48 Y-.5543 Z1.0957
N4203 X-3.51 Y-.5457 Z1.1
N4204 X-3.54 Y-.5371 Z1.1042

Copy, Cut And Paste Wrecks Files
Hi,

I have an integral editor in my application and having trouble with the copy, cut and paste routine. I suspect the problem occurs when the file is opened for edit but I do not know that to be fact. Below I have shown the code that I suspect is causing the problem and below that is a sample of the code showing the problem.

Servo

Dim iFile As Integer, tempstring As Long, templine As String

Open txt_FileName For Input As iFile
Do While Not EOF(1)
Line Input #iFile, templine
 tempstring = tempstring + templine + Chr(13) + Chr(10)
Loop
Close #iFile


N4189 X-3.09 Y-.6631 Z1.0334
N4190 X-3.12 Y-.655 Z1.0386
N4191 X-3.15 Y-.6468 Z1.0437 N4192 X-3.18 Y-.6386
Z1.0488
N4193 X-3.21 Y-.6304 Z1.0537
N4194 X-3.24 Y-.6221 Z1.0587
N4195 X-3.27 Y-.6137 Z1.0635

N4196 X-3.3 Y-.6053 Z1.0683
N4197 X-3.33 Y-.5969 Z1.073
N4198 X-3.36 Y-.5885 Z1.0777
N4199 X-3.39 Y-.58 Z1.0823
N4200 X-3.42 Y-.5714 Z1.0868


N4201 X-3.45 Y-.5629 Z1.0913
N4202 X-3.48 Y-.5543 Z1.0957
N4203 X-3.51 Y-.5457 Z1.1
N4204 X-3.54 Y-.5371 Z1.1042





Edited by - ServoWizard on 2/7/2004 7:40:21 PM

Move/copy/paste Files From Explorer To My App
Hi! Can anyone help me with a file move/copy/paste problem I encountered while trying to get my application to paste files copied or cut in explorer? My problem is that I cannot distinguish between cut and copy. When using the clipboard, all I get is the full file name, but that is not enough for me to figure out if my app should copy or move the file. I also looked at the SHFileOperation function, but I encountered the same problem - how to distinguish if the file was copied or cut. I have my application working with copying the files, although a cut command might have been given in explorer. I will greatly appreciate it if anyone can tell me how can I make the distinction between cut and copy (and for that matter, how does explorer distinguish between the two).

Thanks,

Kalin

Implementing Copy/paste Or Drag/drop For FILES
Well i wanna create an app that lets me copy a bunch of files like explorer does it, but without more then one copy at a time. So if u ask it to copy something when he's already copying, he doesn't do it, he waits that the previous transfer is finished.

It would be like norton commander that we had in dos, 2 list of files, and we can drag/drop and cut/copy/paste from one place to the other.

If anybody knows how to do that (cut/copy/paste or drag/drop) from one list to the other, I would be gratefull for the info


By the way, if this app exist already, i would be glad to download it instead of developping it hehehehe

Copy, Cut And Paste Wrecks Files / Attention Metallisoft
Hi,

Same song second verse. Your suggestions made no difference. Just so you won't trip over the absence og it I have included the "iFile = FreeFile". The copy / cut sequence is so cut and dried that I did not include them in the example. This is a real PITA because it forces the machine into a shut down when it encounters any one of three file errors.

ORIGINAL MESSAGE:

I have an integral editor in my application and having trouble with the copy, cut and paste routine. I suspect the problem occurs when the file is opened for edit but I do not know that to be fact. Below I have shown the code that I suspect is causing the problem and below that is a sample of the code showing the problem.

Let's see if we can kill a couple ducks with one shot here.

I need to know how to kill keyboard key repeats so that the keypress simply turns on a command and does not accummulate them so that when you release the key the accummulated commands do continue on while you're waiting for KeyUp event to issue the cancel command order.

Servo

Dim iFile As Integer, tempstring As Long, templine As String

iFile = FreeFile

Open txt_FileName For Input As iFile
Do While Not EOF(1)
Line Input #iFile, templine
 tempstring = tempstring + templine + Chr(13) + Chr(10)
Loop
Close #iFile


N4189 X-3.09 Y-.6631 Z1.0334
N4190 X-3.12 Y-.655 Z1.0386
N4191 X-3.15 Y-.6468 Z1.0437 N4192 X-3.18 Y-.6386
Z1.0488
N4193 X-3.21 Y-.6304 Z1.0537
N4194 X-3.24 Y-.6221 Z1.0587
N4195 X-3.27 Y-.6137 Z1.0635

N4196 X-3.3 Y-.6053 Z1.0683
N4197 X-3.33 Y-.5969 Z1.073
N4198 X-3.36 Y-.5885 Z1.0777
N4199 X-3.39 Y-.58 Z1.0823
N4200 X-3.42 Y-.5714 Z1.0868


N4201 X-3.45 Y-.5629 Z1.0913
N4202 X-3.48 Y-.5543 Z1.0957
N4203 X-3.51 Y-.5457 Z1.1
N4204 X-3.54 Y-.5371 Z1.1042

How To Copy And Paste Files In Temporary Folder Using Visual Basic
I need to copy and paste files in temporary folder using VB coding..and how to clear the temporary folder using VB as well..

How Can I Copy And Paste Files From Their Folder To Another Folder?
hello,

How can I copy and paste files from their folder to another folder?
using vb code ofcourse...

thanks

Copy Paste / Copy To Cilp Board..
Is it possible to Copy and paste to a Picture Box?
---OR---
Copy from a picture box to Clipboard. Or even save as a pcx or jpg/gif file?...

Thanks...

Copy And Paste
I am trying to copy a gif from windows explorer and pasting it into VBs Image Control and can't get it to paste. This is what I am trying.

Private Sub mnuMemPaste_Click()
Set frmMembers.Image1 = Clipboard.GetData
frmMembers.Image1.Refresh
End Sub

and nothing is getting pasted
Image1 Control:
Drag Mode = Automatic
OLEDrag mode = Automatic
OLEDrop mode = Automatic

The user right clicks on the image control then a context menu popup with a choice copy or paste. Click the paste command sends you frmmain.mnumempaste.

Copy/Paste
I'm not sure if this is a VBA issue, but I thought I would give it try and see if anyone has run into the same issue.

We upgraded to Word 2000 this past June (we don't like to be trend setters) from Word95. Some of the users have problems going back and forth between documents when trying to copy and paste - their machines lock up.

Some of the lock-ups occur when the user is toggling between documents when they use the drop down Window, some are having the problem when they toggle between documents by clicking on the documents located on the bottom of their toolbar, and others have the problem when using Ctrl F6. It's not a universal problem.

Any thoughts? Thanks!

Copy/Paste
Unfortunately Copy/Paste in my workbook needs to be altered. When a user copies data, I need to validate that data and perform certian functions.

Originally I tried to just use "If cutCopyMode = 1 then..." but that doesn't seem to work the way I need it. Also, I would need to trap the enter key event(s) if the user was 'cuting' data to also perform these functions.

What I would like to know is if anyone else has had to replace / alter excel's cut/copy/paste logic and if there is anything I should be worried about.

I started writing procedures to capture 'OnKey' events as well as the menu driven events. But as I mentioned earlier, I need to also capture the enter key(s) event. If this is the only way to go, is there anything that should be going on if the user hit's the enter key(s) besides changing the offset?

-Jeff

Copy/paste
I really need some help I'm on a deadline and I have to find a way to copy specific info from word and paste it in excel. I know what comes before and after the word or number I need does any one know how to do this.


I apoligize in advance this might be a double post but my previous post havent been really clear so I wanted to give a clear idea of what I want to do.

Copy And Paste
An Excel-document with 2 sheets, the first one is filled out like this:

Column A, Column B, etc.

Product A, 15kg, Red
Product B, 17kg, Blue
Product C, 20kg, Green

The second sheet is always empty when the document is opened.

You mark a productname, or several, and press a commandbutton, located on the first sheet, i want VB to copy the marked productnames and its info onto the second sheet, starting to fill it with info from the top.

I am new to VB so i would really appreciate specific code to get me started.
Thanks in advance.
G

Cut, Copy, And Paste
I Cant Seem 2 Get My Cut Copy And Paste Menu Buttons Working. Heres My Code:


Code:
'Cut
Private Sub mnuCut_Click()
Clipboard.Clear
If rtbText.SelLength = 0 Then
rtbText.SelStart = 0
rtbText.SelLength = Len(rtbText.Text)
End If
Clipboard.SetText Screen.ActiveControl.SelText
Screen.ActiveControl.SelText = ""
End Sub


Code:
'Copy
Private Sub mnuCopy_Click()
Clipboard.Clear
Clipboard.SetText Screen.ActiveControl.SelText
End Sub


Code:
'Paste
Private Sub mnuPaste_Click()
SelText = Clipboard.GetText
End Sub

Cut/Copy/Paste
I have a MDI form and some MDI Childs forms.
I want to implement Cut/Copy/Paste in the program.
I want to know how can i retrieve the handle of the textbox that has the current focus in the program so that I can cut/copy/paste/select all ?

Copy And Paste
Hello! I hope this hasn't been disscussed before...if it has just send me the link and delete this post. (i haven't found such a thread tho')

I wanna' develop a VB application which has to take some information from a web page. I want this to be done by selecting the whole page (Ctrl+A) in the users browser then paste it into the program...when he pastes the page only certain areas of the text in the page need to be pasted into the available text boxes. (not necessarily text boxes...) I want these text areas to be selected automatically by the application without the user having to manually enter each information into each of the text boxes.

Got any ideea how to do this?

For example let's say the following is the text from the web page:

>>Phone Number: 40334421
>>Name: Will Smith
>>Comments: Actor

When I paste the whole text into the VB application i want only 40334421 to be pasted into the txtPhnNo textbox, the Will Smith pasted into the txtName textbox and Actor pasted into the txtCmnt text box.
I hope you undesrtand where I'm going with this.

Thanks

P.S. I work with VB 6.0

Copy And Paste
I have created a simple program in visual basic that checks data entered to make sure its in a certain format. Is is possible for this program to be modified so that it can copy the data entered and paste it in anouther program for example notepad?

Copy And Paste
Hello,
I am trying to implement the Copy and Paste functions. I got "the selecting the text" part done but I am having trouble pasting the text. That is, my question is how do we refer to the position the mouse is at. And since I am trying to do the paste on a text box how do I implement this ?

For example, I can't do something like Text1.Text = Text1.Text + Text1.SelText.

Any advice?

Copy > Paste
I Have two web browsers

Web Browser one displays just text
Web Browser two displays a text box

Is there any way that when I Copy the text in Web Browser one, it automaticlly pastes in web browser 2?

Thanks

Vba Copy And Paste
I am selecting a range out of worksheet and copying it to another. the worksheet is saved with protection after the macro runs the workbook closes itself and when I reopen it the sheet is no longer protected. Why is it doing this and how can I stop it? I don't want to save the sheet with the macro because I do not want to save the new data on the sheet.

Copy/Paste Huh?
let say you have a macro that copys and paste stuff in a huge worksheet. takes 5 min to run.

while the macro is working you go on the web and ctrl-c an article from bbc.com

when i press ctrl-v i get text from my worksheet instead of the article. While my excel sheet has my bbc article on it. WTH!

Copy And Paste
I want to prevent the user from copy and paste how do i do that using vb?

Copy And Paste
Hey everyone,
simple question. How do you make a listbox capable of Ctrl+C (copy)?
Also, along the same lines, how do you make it Ctrl+X (cut) and Ctrl+V (paste)

And one other thing. Is it possible to have a code/script/macro that can automatically take info from my program and enter it in to a web-site, say like E-bay. I'm trying to simplify some of my web browsing by having a program automatically enter username/password. Like I have a selection choice in my program for "Hotmail". When selected, I need it to take the settings from the "Hotmail" area and automatically prefill it into the Hotmail website for me. Is that even possible?

Thanks all!

Copy And Paste !!!!
I am new to VB , not completed anything that works as yet....
Mainly because i'm asking too much of myself....maybe the idea I have for my next one is too much also , could you give me a rating for the below ? Beginner , medium etc..

Project :

Be able to store all "copied" (with right mouse click) into one word document , so you can go back to earlier copies etc


Sound easy , But is it ?


Rgds

Cut, Copy, Paste, Etc How Can U Do Them
hey, i was just trying to figure out how to add a button in vb that when pressed copies, cuts, pastes or watever with a bit of text

could someone help

Copy And Paste
hi i need ny program to copy a file like "new word.txt" to somewhere like "C:word documents" and call it's self "Text1.txt" insted of "New word.txt" i hope you know what i mean. so i want the program to get the file it has made and make a copy to "C:word doucumentsText 1.txt" ok it's not a save command but like a log book.
thanks

Cut, Copy And Paste
hi

i know that using

clipboard.settext txtbox.seltext

and

txtbox.seltext=clipboard.gettext()

will copy and paste text to and from clipboard and txtbox.

what can i do so that this will work for other textboxes?

thx

Copy,paste,cut
i need a menu to be able to cut,copy,paste text in a textbox.......
how do i acomplish this?

Cut Copy Paste - Please...
I am still not quite sure of, nor do I understand the code for 'cut, copy, paste, and undo'. I have had lots of help from people, and lots of different code, but I still fail to get it to work.

I have menu items
mnuCopy
mnuCut
mnuPaste
mnuUndo
All I really want them to do is cut, copy, paste, and undo. Is there some way that I can call "ctrl + X" when user clicks mnuCut?

I know this code is probably very simple, and I am making it difficult for myself, but is there anyone who can show me how to do this? It would be great.

Thanks.

-UseTheMan

CUT, Copy, PASTE
How would I write the code for cut, copy and paste commands?

Would I just use seltext method somehow?

Thanks

-UseTheMan

COPY AND PASTE
I have a menu on my application and I want to enable de paste menu only if there is something on the clipboard

how can I do this?????

A code will be really helpful

Copy && Paste
Ok..this may seem dumb..but I am fairly new to VB so i was wondering If anyone can tell me how to scipt COPY & PASTE on my menu bar.

I used Visual Studio to do the menu abr but now trying to get the buttons to work is becoming mroe difficult than anticipated...any help would be HIGHLY appreciated

THNX

Cut, Copy And Paste
i am making a notepad thing and i want to have cut, copy and paste in the menu. Apparently you cannot do this with the textbox i have because it does not support the sel argument. however if i right click the selection on the textbox, it cuts, copys and pastes the text. How would i simulate the right click -copy or paste etc in my code.

Copy And Paste
I need some help with copy and paste. I have a sstab that is loaded with labels ranoamly placed on the sstab at run time. Tabs are added when no more labels will fit. I need to know if i can copy and paste (or drag and drop)one the the labels from one tab to another tab.

Copy And Paste From One HD To Another
i would like to copy and paste a file from one hard drive to another using a program made in visual basic. i have used a driveListbox, a DirListBox and a FielListBox to show files from a selected directory.. can someone please tell me the code to copy and paste a fiel which is selected in the FileListBox.


Code:
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub

Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub

Private Sub File1_Click()
Copy File1.FileName
Paste File1.FileName
End Sub

Thanks

Sam

Copy / Paste Exe Help.
Aight, this is what i need.

- I need a program ( Program1 ) to copy it's self when you press Command1.
- Then paste that copy in a folder called "Folder2" in program1's folder.
- Then make a text file in Folder2 named "Log.txt", and print "Complete" in the text file.

If this can be done, plz let me know.

Cut Copy Paste
how would i cut, opy or paste into a text box by clicking a button?

Cut, Copy And Paste
What is the syntax for cutting, copying and pasting from clipboard?

Thanx

Copy And Paste...
how can i do this :

When i run the program it copy's another program from a path and paste into a path i tell him then colse this program and then run the program which i copied in to path

help plox!

Copy Paste
how possible create button for command copy , paste?

ctrl+C , ctrl+V ?


Thanks.

- Cut - Copy - Paste
hi there,
i'm making an application for game purpose, in which app. user r going to create map(hope some body there knows about map). basically map consists of a tiles in a grid of rows and columns, with layers functionality.
here i want to add a feature of CUT-COPY-PASTE, using this feature user will be able to cut part of map and paste it where ever desired(as normally cut-copy-paste functions).
here my problem is the map is not only a picture box, actually it acts as a container which holds several picture tiles in the grid of rows and columns. this grid is made up of using array of structure which holds the indexes picture tiles.

do any body have any idea how to do this.

plz help

thanx in advance
harry

Copy && Paste
Hey, I am trying to get my app to copy selected text and paste it but it wont put it onto the clipboard, I searched on the net and this is what quite a lot of sites said to do


VB Code:
Private Sub mnuEditCopy_Click()Clipboard.SetText rtbMain.SelTextEnd Sub


Can someone tell me whats wrong with it

Copyright © 2005-08 www.BigResource.com, All rights reserved