Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Special macro

Take a look at the example for FileCopy in VBA's help.

Option Explicit
Sub auto_open()
Dim FromFileName As String
Dim ToFileName As String

FromFileName = "h:\mapname.bmp" '???
ToFileName = "c:\mapname.bmp" '???

FileCopy Source:=FromFileName, Destination:=ToFileName

'ThisWorkbook.Close savechanges:=False

End Sub

Put save this workbook into your XLStart folder.

I commented the last line out. When you're done testing, uncomment it and save
your workbook. When it runs it'll close this workbook--not so good for testing!



Alvin Hansen wrote:

Hi!
I want to make a macro there can
copy a map from one destiantion to another destination
F.esk H:/mapname to c:/mapname
An i want it to do this evrytime I start my excel file

Hope one can help

Alvin


--

Dave Peterson

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Special macro

map = folder????

Option Explicit
Sub testme()

Dim FSO As Object
Dim FromPath As String
Dim ToPath As String

FromPath = "C:\temp"
ToPath = "C:\my documents\excel\test"

Set FSO = CreateObject("scripting.filesystemobject")

If FSO.FolderExists(FromPath) = False Then
MsgBox "From Folder doesn't exist"
Exit Sub
End If

If FSO.FolderExists(ToPath) = False Then
MsgBox "To Folder doesn't exist"
Exit Sub
End If

FSO.CopyFolder Source:=FromPath, Destination:=ToPath

End Sub



Alvin Hansen wrote:

Thanks but i get a error
I have write this
Remember it not just a file but a hole map
with map and files in

Dim FromFileName As String
Dim ToFileName As String

FromFileName = "h:\city breaks" '???
ToFileName = "c:\city breaks" '???

FileCopy Source:=FromFileName, Destination:=ToFileName

the name "city breaks" is the name on the map

Best regards

Alvin

"Dave Peterson" skrev:

Take a look at the example for FileCopy in VBA's help.

Option Explicit
Sub auto_open()
Dim FromFileName As String
Dim ToFileName As String

FromFileName = "h:\mapname.bmp" '???
ToFileName = "c:\mapname.bmp" '???

FileCopy Source:=FromFileName, Destination:=ToFileName

'ThisWorkbook.Close savechanges:=False

End Sub

Put save this workbook into your XLStart folder.

I commented the last line out. When you're done testing, uncomment it and save
your workbook. When it runs it'll close this workbook--not so good for testing!



Alvin Hansen wrote:

Hi!
I want to make a macro there can
copy a map from one destiantion to another destination
F.esk H:/mapname to c:/mapname
An i want it to do this evrytime I start my excel file

Hope one can help

Alvin


--

Dave Peterson



--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 209
Default Special macro

Thanks, many many thanks

Yes is was a folder -- my bad english

Sorry

Best regards

Alvin

"Dave Peterson" skrev:

map = folder????

Option Explicit
Sub testme()

Dim FSO As Object
Dim FromPath As String
Dim ToPath As String

FromPath = "C:\temp"
ToPath = "C:\my documents\excel\test"

Set FSO = CreateObject("scripting.filesystemobject")

If FSO.FolderExists(FromPath) = False Then
MsgBox "From Folder doesn't exist"
Exit Sub
End If

If FSO.FolderExists(ToPath) = False Then
MsgBox "To Folder doesn't exist"
Exit Sub
End If

FSO.CopyFolder Source:=FromPath, Destination:=ToPath

End Sub



Alvin Hansen wrote:

Thanks but i get a error
I have write this
Remember it not just a file but a hole map
with map and files in

Dim FromFileName As String
Dim ToFileName As String

FromFileName = "h:\city breaks" '???
ToFileName = "c:\city breaks" '???

FileCopy Source:=FromFileName, Destination:=ToFileName

the name "city breaks" is the name on the map

Best regards

Alvin

"Dave Peterson" skrev:

Take a look at the example for FileCopy in VBA's help.

Option Explicit
Sub auto_open()
Dim FromFileName As String
Dim ToFileName As String

FromFileName = "h:\mapname.bmp" '???
ToFileName = "c:\mapname.bmp" '???

FileCopy Source:=FromFileName, Destination:=ToFileName

'ThisWorkbook.Close savechanges:=False

End Sub

Put save this workbook into your XLStart folder.

I commented the last line out. When you're done testing, uncomment it and save
your workbook. When it runs it'll close this workbook--not so good for testing!



Alvin Hansen wrote:

Hi!
I want to make a macro there can
copy a map from one destiantion to another destination
F.esk H:/mapname to c:/mapname
An i want it to do this evrytime I start my excel file

Hope one can help

Alvin

--

Dave Peterson



--

Dave Peterson


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a special macro sbidaho Excel Discussion (Misc queries) 3 September 10th 08 01:28 AM
Cut & Paste Need Special Macro Miss Kitty[_2_] Excel Discussion (Misc queries) 6 August 25th 08 09:12 PM
Special keystrokes in a Macro Eric Excel Discussion (Misc queries) 4 May 18th 05 02:26 PM
Paste Special in a macro CMAC Excel Worksheet Functions 2 December 6th 04 10:19 PM
Paste Special Macro Aaron Excel Programming 4 August 13th 04 12:35 AM


All times are GMT +1. The time now is 04:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"