Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Import multiple files macro can't find files

I recently wrote a macro which imported 36 files into the
same MSWord document. It worked fine when the day I
wrote it, but today ithe error message "file can't be
found" appears. And now, just as I began writing this,
the Macro began working again. Said Macro is below.
What determines where the macro looks for these files
(which folder/directory?)

Steven

Sub Insert36()
'
' Insert36 Macro
' Macro recorded 7/30/03 by Karen Demelio
'
Selection.InsertFile FileName:="001", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="02", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="03", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="04", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="05", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="06", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="07", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="08", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="09", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="10", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="11", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="12", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="13", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="14", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="15", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="16", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="17", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="18", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="19", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="20", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="21", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="22", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="23", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="24", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="25", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="26", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="27", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="28", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="29", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="30", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="31", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="32", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="33", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="34", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="35", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
Selection.InsertFile FileName:="36", Range:="",
ConfirmConversions:=False, _
Link:=False, Attachment:=False
End Sub


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Import multiple files macro can't find files

Steven.

... you didn't write it you recorded it... :)

and it could be done a bit simpler.

Sub Insert36()
Dim sFldr as String
Dim i as Integer

If msgbox ("will read from folder " & vba.curdir) < vbOk then exit sub
For i = 1 to 36
Selection.InsertFile FileName:= Format(i,"00")
Next

End Sub

keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


Steven Rosenberg wrote:

I recently wrote a macro which imported 36 files into the
same MSWord document. It worked fine when the day I
wrote it, but today ithe error message "file can't be
found" appears. And now, just as I began writing this,
the Macro began working again. Said Macro is below.
What determines where the macro looks for these files
(which folder/directory?)

Steven

Sub Insert36()
'
' Insert36 Macro
' Macro recorded 7/30/03 by Karen Demelio





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

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
Import all txt files macro Eva Excel Worksheet Functions 4 December 2nd 09 09:19 PM
Import Multiple XML Files into Excel Mungkol Excel Discussion (Misc queries) 3 January 22nd 09 01:37 PM
Import multiple text files (Macro) Thr33of4 Excel Discussion (Misc queries) 0 September 19th 06 02:19 AM
problem with import files by excel macro Raven Excel Discussion (Misc queries) 0 January 20th 06 08:23 AM
Import CSV files using Macro Mintz87 New Users to Excel 3 August 29th 05 09:48 PM


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

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

About Us

"It's about Microsoft Excel"