View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
jln via OfficeKB.com jln via OfficeKB.com is offline
external usenet poster
 
Posts: 88
Default automate importing

Ok that gave me a good start i have it opening the file then coping. My next
step would be how do i make it activate the right workbook. The work book
names are always different.

Dave Peterson wrote:
Recording the macro will get a lot of the code.

Then you can start tweaking it...

Option Explicit
Sub Testme01()

Dim myFileName As Variant

myFileName = Application.GetOpenFilename(filefilter:="CSV Files, *.CSV", _
Title:="Pick a File")

If myFileName = False Then
MsgBox "Ok, try later" 'user hit cancel
Exit Sub
End If

Workbooks.Open Filename:=myFileName '....rest of recorded code here!

End Sub

A record macro will not help me in this case becuase the file name changes
for each person thats why i want to use GetOpenFilename. Im just not sure how.

[quoted text clipped - 12 lines]
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200611/1



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200611/1