macro question

Mar 20, 2007 18:09

Anyone know how to make a macro that will copy a directory from one area of a server to another and rename it? We are creating a new file structure at work and we want to create a master template folder which using a macro we just enter the name and it copies the template to the Projects directory under the pre-defined name?

Is this possible?

Leave a comment

Comments 5

nutti_tart March 21 2007, 09:10:41 UTC
I don't know how you do it, but it is possible, we have one here for creating new folders, its a vbs script file (or at least thats what it says) click it, put in the file name and it creates the folder with all the sub folders etc in it.

Reply


uncanic March 21 2007, 11:14:58 UTC
two words batch file

Reply


justtom March 21 2007, 12:05:38 UTC
As Nic said, you can probably do it simpler with a batch file. Tho it's a little vague what you want. Try this for starters, the codes pretty self explanatory:

Sub copy()
' create variables
Dim message, title, defaultvalue As String
' messagebox prompt message
message = "Enter filename"
' messagebox prompt title
title = "Filecopy"
' messagebox prompt default value
defaultvalue = "Enter filename here"
' pop up input box
myValue = InputBox(message, title, defaultvalue, 100, 100)
' create destination string
Dim destination As String
destination = "c:\temp\test\" & myValue
' copy files
FileCopy "c:\temp\a.tmp", destination
End Sub

Reply

elthorn March 21 2007, 22:38:20 UTC
thanks for that, seem to get a runtime error though end statement expected line 3 char 34 Error 800A0401 any ideas?

Reply

justtom March 22 2007, 08:51:01 UTC
Try declaring the variables on different lines?

It probably depends on what version of VB you're using and it's not really my strong point I'm afraid.

Reply


Leave a comment

Up