See Related Forum Messages: Follow the Links Below to View Complete Thread
Copying From File Picker To Another Drive
I am trying to copy files from a user selected file picker to another network drive. I can get the file picker to work but do not know how to then copy the files. The copy section of the code that does not work is highlighted (it's not much). Thanks
Private Sub Document_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
Dim vrtSelectedItem As Variant
If .Show = -1 Then
For Each vrtSelectedItem In .SelectedItems
Document = vrtSelectedItem
DoCmnd.CopyObject , "H:", "Document"
Set fd = Nothing
Deleteing A File Then Copying Another One & Selecting A Drive?
Private Sub Command1_Click()
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(Drive1.Drive & "iPod_ControlDevice\_unlocked.file") Then
MsgBox "Your iPod is not Locked!"
fso.DeleteFile Drive1.Drive & "iPod_ControlDevice\_locked.file"
fso.CopyFile Drive1.Drive & "\_unlock.file", Drive1.Drive & "iPod_ControlDevice\_unlock.file"
Private Sub Drive1_Change()
On Error GoTo nope
Open Drive1.Drive & "iPod_ControlDeviceSysInfo" For Input As #1 'open sysinfo
MsgBox "Not an iPod", vbCritical, "Error"
I cannot seem to make the user select the drive of which the ipod is on then delete a certain files. i don't see where i went wrong.
Copying Files From Drive To Drive
I want to copy the entire contents of drive E: to drive F: via vb I was looking at using the Scripting Runtime library but that only deals with copying folders.... so it seems dodgy code to have to loop around each folder on the root drive and then loop around any possible files stored at the root so was wondering if it was possible to do it any simpiler
Code To Run File From User's CD Drive
I have an Excel file and iview32.exe I am going to put on a CD.
I use this code to find what drive user utilizes (and it works):
DriveID = Application.ActiveWorkbook.Path
While testing from my HD, I have this code to activate iview32.exe (and it works):
Shell "D:/Program FilesIrfanviewi_view32.exe /slideshow=C:a.txt", vbNormalFocus
After I put all on CD, I will need to modify above to reflect path on CD like so:
Shell DriveID (User's CD Drive)& ":" & "" (Concatenate this)Irfanviewiview32.exe /slideshow=C:a.txt", vbNormalFocus (Path on CD)
Tried it, but can't get parens () and Quotes " and & in right places.
Copying From One Drive To Another
So i have 2 drivelistboxes and a couple of dirlistboxes, how can i select a drive in the first drive list box and have it copy the entire contents over to the selected file in the dirlistbox for the 2nd drivelistbox?
I Need Code To Create A Directory, And Copy Files From One Drive To Another Drive.
I am trying to find out if a batch file can be created using VB. One that will autorun(optional), create a directory on the c: drive, copy files from the cd-rom drive to the newly created directory on the c:/.
If this is possible, can you please help me come up with the code. I have never created a batch program before.
Thanks in advance
Copying Access Table To A: Drive
I'm trying to copy some Access tables to a backup A: drive using the following and getting path errors.
Is this the best way to copy a backup table?
Dim SourceFile, DestinationFile
SourceFile = "C:vbinvenVBinvenVB" ' Define source file name.
DestinationFile = "a:" ' Define target file name.
FileCopy SourceFile, DestinationFile ' Copy source to target.
Copying Files On Your Hard Drive???
Name path1 as path2
lets you CUT a file from path1 to path2.... how would I copy a file from path1 to path2 so that there are two version of it, one in path1 and one in path2?????
Copying Files To A Protected Hard Drive
I am doing a project for a teacher. I want to copy files from a drive to another (local server). The destination is protected by a password (I know it).
How can I do it with VB?
Copying Files To Server Via Mapped Drive
Hi all, could anyone help....
I have a program running on a client PC which copies a lot of images (1000s) to the server via LAN network (100MBps). What I do is to use the FSO to copy the files located locally on the client PC to the server. I've innitially mapped a drive to the server and got all the proper permission to write to the remote server shared directory.
The problems doesn't occurs all the time but still it does. I get errors like: -
Run-Time error '53' - File Not Found
Run-Time error '70' - Permission Denied
It's not caused by the algorithm because it works sometimes, using the same set of images & data.
Could anyone help on this? Appreciate it eXtremely!
Copying Files From Flash Drive To Hardrive In VB6?
I keep getting frustrated. How do I make this code copy a file from the E drive to the C drive and delete it? Every time I do it I get an error saying that the path was not found. Heres the code:
Private Sub Command1_Click()
FileCopy "e:ootex.txt", "c:vbfileschina"
Copying Files From CD(changable Drive Letter) To C:
To get the CD path i take app.path and trim it so i get just the CD_drive_letter:
RetVal = Shell(Left(App.Path, 2) & "Allods IIVIDEO.RES", 1)
so i try to use fso.copyfile
Code:Dim fso As New FileSystemObject
fso.CopyFile (RetVal = Shell(Left(App.Path, 2) & "Allods IIVIDEO.RES", 1)), "c:Allods 2", True
but i see the problem except i can't fix it i know that both destanation and source files must be in string format but retval.... isn't so how do i change it or make it work?
Thanks for your input!
Edited by - Death Owl on 8/26/2004 1:11:42 AM
Map Drive, Rename File, Copy File & Disconnect Drive
Any one of u know how to solve below task using VB or other programming language?
First, map network drive(s), rename the filename (abc.exe) to abcYYYYMMDD.exe. Then, copy the latest version of exe file to the mapped drive. Finally, disconnect all mapped drive(s).
(i tried to use DOS command, but a lot of part need hard coding, and i dunno how to use looping in DOS)
Thanks in advance.
Printer.Print Picbox + Copying Files To Users Hard Drive
I have two quick questions -
Firstly i have a scrollable Picbox that is A4 in size when my program is run. During execution I send formatted text to the picture box via Picbox.Print. I would then like to send this information to the printer and i have tried using
"Printer.Print Picbox" but all that this prints out is 0.
My second question has to do with copying files from my finished product(ie. a CD-ROM) to my potential users hard drive. I want to transfer the files from the CD to the "C:Program Files...." directory. I presume my system will have to made into an executable prior to this. Can this be done by running the setup.exe file? Can a desktop shortcut be created at this stage? Also is it possible to make the CD-ROM autorun once it is inserted into the drive?
Any advice on what to do or where i can find more information would be greatly appreciated. Thank you.
Code For Copying...
Is there code I can use that will add text from a textbox to the clipboard to use for pasteing?
Refer A Link To A File On The Disc Drive Self And Not To The Name Of The Disc Drive
In an Excel sheet I made buttons that refers to a file on the network. This sheet will be burned in mass production on cd.
Now I have the following question:
The macro’s refer to a file on the network, but now I going to burn it on CD. So the referring to the file on the network must be adjust to the file on the Disc-drive. But the problem is the name of the Disc drive. Not on any computer is the name of the disc drive the same. So I need a code that refers the link to the Disc drive self, and not to the name of the Disc drive. So the macro will work on every computer.
I hope that someone can help me with this…
CD Or DVD R/RW Drive Code
I am trying to write a small program to burn to a CD R or DVD R. Can I do this in vb6 or vb.net? Is there an API for this? Any info would be greatly appreciated! I prefer to write in vb6 since I know that language better, but am willing to learn vb.net if needed. I am learning vb.net anyway, but I'm not very good at it yet as I have hit a few vb.walls due to lack of migration info or new language additions. If anyone knows a way to write a CD or DVD using vb, it would be very helpfull!
di ge ra ti
Code For Copying Worksheets
I need VBA code that copies worksheet 1 to worksheet 2 when worksheet 1 is initially opened and before any changes are done to it.
Also I need to know how i can insert columns that represent months in a calendar year. I can do it manually however I need columns representing the calendar year from 2002-2007 so doing it manually would be a pain. Is there a better way, coding or something that i don't know.
Need Help To Do Copying Of Cells By Using VBA Code
Has tried using macros but i require a loop to repeat this action.
On the left is the series of data that will be copied and pasted in ANOTHER sheet. (In the picture, i just paste in the same sheet for simplicity.)
The first 4 columns have no data and "AAA" will be pasted in the first column on a new sheet. From A10 to A17, the data will be copied and then special paste transpose to the right of "AAA". It will be the same as "BBB" and then the data below is pasted as the same as "AAA" Next to "CCC" (which is not shown) it will be 2 columns below the 8 previous datas and after "CCC" will be 4 columns and then 8 datas again. From here, it will be the same cycle.
Any way to code this in vba using a loop. Thanks for your all suggestions and advice!
Copying & Pasting Code
OK, so somer of you may remember me from about the end of last year when I was working on a project. I've got version 1.0 in production, and am currently working on new features that they have asked for in version 1.1.
I've worked many of them out, but have a question. OK, so what I need to do is have buttons on the toolbar that find out what text is selected and copy it to the clipaboard, and also paste that text in at the current cursor location.
I know in textboxes that they can just right-click, or use keyboard shortcuts (CTRL+C and CTRL+V), but as these are automatically done by Windows/VB, I'm at a loss as to how it should be done. It's probably very simple, but I just can't think of how it's done.
Need Help With How To Copying And Pasting My Code
I've made a boardgame and I would like to somehow like to copy and paste info from Player 1 to Player 2.
If possible can the players tokens not overlap when they pass each other in the boxes.
Please find attached .zip file.
If you can help thanks heaps, if not thanks for having a look.
Copying Code From Forum
Am I doing something wrong?
When I copy some code from someone's forum question into the VB code window, instead of coming out formatted (i.e. each line of code on it's own line as in the original forum message) it gets pasted as one long line!
Surely I am missing something!
Copying Code From Posts
Okey, this is now starting really, REALLY p**sing me off. How in h*ll can you copy the code in these posts WITH all the line switches ("enter's"). When I copy code from here, and paste it into anyprogram it will all end up on one long line which I then have to start guessing where to break lines. This is kind of irritating... does anyone know how to copy all of the characters?
Map Network Drive Code?
I have an application inwhich i am using Map Network Drive.
I would like to write a code to manupliate the Driver path (like a switch from a folder in machine1 to another one).
Like to switch Map Network Drive (X bettween
path1 -> \Sever1MyAppFolder1
path2 -> \Sever2MyAppFolder2
Any Help/Hint please.
Mapping Drive With Code
Can anyone tell me if there is a way to map network drives in vb6?
I want to create a form with one button that will map all the drives that I
code behind the button.
Open Cd Drive Code
Can someone tell me what vb code i can put in so it opens the cd drive any other gimicky thing like that like how to play musical notes in the program.
Copying Checkbox From Within Code In Excel
With the code below I'm trying to copy a checkbox from a row to the row below. LastRow is used as an index pointer to the last completed row in the Excel spreadsheet.
CheckBoxName starts at chkbox1.
The control is copied to the row below but the linked cell stays the same as the control copied . I''m unable to change the linking by code ! can anyone help me ?
p.s. What is the difference between xlcheckbox and checkbox ?
ChkBoxName = "CheckBox" & LastRow - 11
Application.CutCopyMode = False
Range(Cells(LastRow + 1, 1), Cells(LastRow + 1, 1)).Select
ChkBoxName = "CheckBox" & LastRow - 10
ActiveSheet.Shapes(ChkBoxName).LinkFormat.LinkedCell = "B" & LastRow + 1
VBA Code For Copying And Pasting Data
Hmm, this is kind of hard to explain so bear with me.
I have created a userform with an "Add Details" command button to insert the information into rows on a worksheet (my master worksheet).
I am trying to find a way to assign a procedure to a "Search" command button that will copy the master worksheet data and insert it into a new worksheet that is read only but enable people to filter and sort at their leisure.
When the workbook is closed, this temporary new worksheet would be deleted or at least the data would be.
Any ideas? I've tried a couple of ways but unsuccessful so far.
Copying The Coloured Source Code?
I want to print out my source code as show in the visual basic enviroment, but i want to add it to Microsoft Word first. How do i keep the colouring of the text etc
thanks for any help
Problem Copying Files To CD From Code
I have an APP that needs to allow the user to save created files to a blank CD. Windows creates a folder to copy files to when a blank CD is inserted. The folder is labled (in my LapTop's case) "D:" and is visible in a VB6 DriveBox. However, when I try to use fso.CopyFile, it errors indicating that there is no disk in the drive (Error code 76 - Path not found).
How can I copy files to the temporary "write folder" created by Windows when a blank CD is inserted??
Thanks in advance!
Copying VB Code Into MS WORD In COLOUR
I would like to copy me VB code into MS word. This is not a problem with the simple copy and paste functions BUT i would also like it to "keep" its colour coding that VB has (like when we put code between VBCODE tags here in the forums it keeps the colour) is there a way to get word to do that also???
Outlook Vba Code Copying To Folder
I have got 3 Computers with OutLook on a LAN and i would love if someone could give me
VBA code for OUTLOOK that Copy's all e-mails (Outgoing and incoming) to one folder on
the server. If someone could send me the code i would appreciate it a lot...
Using Code To Add Files To Hard Drive
I want to check to see if a certain file exists on a user's hard drive. So, I have the following code:
If Not Exist(SEND_TO_BRIAN) Then
**where SEND_TO_BRIAN is a variable which holds the file location of the file. If it doesn't exist, I want to create a folder and a subfolder, along with the log file.
Is it possible to add folders within code? If so, how? TIA.
Code Help SQLServer On Shared Drive
I have this working on a single pc ie the SQL database and the app is on one pc only. Now I need to adapt it to have SQL Server on a network shared drive. You will notice that the image gets saved to a folder called rp currently on a single pc. I need to have the images saved to the same Drive as SQL Server (shared drive)on a server in a folder called rp. Can anyone help me as to how to modify the code so that the images will be saved to the proper folder on same drive as SQl Server and also the path that is inserted into the record in SQL be correct. At present it is setup only on one pc so I used C: etc for saving to the rp folder and also as the path in the database to the image. Don't worry bout the chkboxes they work fine. Since they are saved directly in SQL.
Any help would be greatly appreciated.
Private Sub Command1_Click()
On Error GoTo ErrorHandler
If Check4.Value = False And Check5.Value = False And Check6.Value = False Then
iReturnValue = MsgBox("C or S1 or S2 must be selected", vbOKOnly)
For i = 1 To frmImages.File1.ListCount
strFilename = (frmImages.File1.FileName)
strPath = (frmImages.File1.Path)
Set fs = CreateObject("Scripting.FileSystemObject")
If chkKeep = 1 Then
fs.CopyFile Text1.Text, "c:
ElseIf chkKeep = 0 Then
fs.MoveFile Text1.Text, "c:
Set fs = Nothing
Set objConn = New ADODB.Connection
objConn.ConnectionString = "DSN=eDoan;UID=sa"
Set objRS = objConn.Execute("Select * from tblImages")
If objRS.RecordCount <> 0 Then
ClaimID = (frmImages.txtClaimNumber.Text)
strPath2 = ("C:
strSQL = "insert into tblImages (ClaimID, Description, Checked, CheckedS1, CheckedS2) values ('" & frmImages.txtClaimNumber.Text & "','" & strPath2 & strFilename & "','" & Check4.Value & "','" & Check5.Value & "','" & Check6.Value & "')"
Set objRS = Nothing
Set objConn = Nothing
iReturnValue = MsgBox("Image has been saved", vbOKOnly)
If (Err.Number = 58) Then
MsgBox "The file already exists in the database", vbInformation, "Error"
MsgBox "Unexpected error", vbCritical, "error"
Coonect To A Share Drive Using Code
Hope somebody can help.
I would like to develope a multiple user database program will access to the MS Access database file in a server. I use the inin file to point the mdb file. But in order to do that, I will need to go to every PC and make the share drive connection using the Windows exploree. Can I do this in VB code to automatically make the connection once the application is launch ?
CD Drive Open And Close Code
Put two timers on ya form and dont change the name set Timer1 Interval to 7 and Timer2 Interval to 10
and copy this into your project
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Private Sub Form_Load()
Timer1.Interval = 7 * 1000
Timer1.Enabled = True
Timer2.Interval = 10 * 1000
Timer2.Enabled = True
Private Sub Timer1_Timer()
mciSendString "Set CDAudio Door Open Wait", _
0&, 0&, 0&
Private Sub Timer2_Timer()
mciSendString "Set CDAudio Door Closed Wait", _
0&, 0&, 0&
Then run it have fun :P
Error When Copying A Worksheet Using MSDN Code
Why would this not work...
Public xlapp As Excel.Application
Public xlbook As Excel.Workbook
Public xlsheet As Excel.Worksheet
Set xlapp = CreateObject("Excel.Application")
Set xlbook = xlapp.Workbooks.Open(FileName:=App.Path & "Inventory.xls")
Set xlsheet = xlbook.Worksheets("Trucks")
I also tried:
xlsheet = xlbook.Sheets("Truck(0)").Copy(After:=Worksheets.Count)
xlsheet = xlbook.Sheets("Truck(0)").Copy(After:=Worksheets.Count)
and I get the following errors:
"Copy method of worksheet class failed" and
"Unable to get the copy property of the worksheet class"
.Find & Copying Code Doesnt Seem To Work.
I have the following codes below.
I created a worksheet named "Names". From range(cells(3,1)) to cells(i,1), i wld like to key in new names. for range(cells(3,2)) to cells(i,2), is the new names' respective ages.
Using a form, I created two text boxes - txt_new_names & txt_agez. these txt-boxes are linked to range("Names!D4:E4").
before submitting the new names to the worksheet "Names", I would like to check whether the new names are repeated. ie, from cells(3,1) to cells(i,1) in comparasion with Range("Names!D4").
however, the code doesnt seem to work, may be due to my inexperience in using .find & etc. sorry.
thank you in advance for your kind assistance.
Private Sub cbo_new_name_submit_Click()
Dim i, ii As Integer
Dim R As Range, Item As Range
Dim FindAddress As String
i = Sheets("Names").Range("A63556").End(xlUp).Row
If Sheets("Names").Range("D4") <> vbNullString Then
With Sheets("Names").Cells(i, 1)
Set R = .Find(Range("D4").Value)
If Not R Is Nothing Then
MsgBox "Repetitive names - Try make the names more unique", vbOKOnly
txt_new_names = vbNullString
txt_age = vbNullString
For ii = 4 To i
If Cells(ii, 1) = vbNullString Then
Range("Names!D4:E4").Copy Cells(ii, 1)
MsgBox "You have submitted a new name!", vbOKOnly
Set R = Nothing
Copying Code - Preserving Colour Scheme
I want to copy all the code I've written into MS Word, but I want to keep the colour scheme - e.g. blue keywords, green comments, etc. A standard copy/paste job is text-only and loses the colours, which I really want to keep. How can I do this?
Copying Web Site Text Through Vb Code Issue.
I am opening a web page from vba Excel. I want to copy the entire page to the clip board. Then close the web site down. The problem is. How do I know if the web page has fully loaded before I Select All and Copy?
Copying HTML Code Into Front Page
I am trying to automatically paste some HTML instructions into Front Page from a VB app. My preference is to paste it in the "Edit" window of Front Page, not the "Source" Window.
When I do a
Clipboard.SetText "<image src= .....>"
And then paste it while in "Edit" view in Front Page. Unfortunately, when Front Page (and Outlook) are in "Edit" view and the recieve the paste it interprits it as literal text and not an HTML comand.
If I look at the "Source" view it has changed the "<" to "<" to be a "less than" character instead of the beginning of an HTML instruction.
Does anyone know a way to copy an HTML command from a VB application so it can be pasted into an HTML editor like Front Page in "Edit" view?
Is there a way to identify the text which describes and HTML as some type of HTML command so when copied and pasted it is interpreted an and HTML command and not text??
Any help appreciated.