Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Import all txt files macro | Excel Worksheet Functions | |||
Import Multiple XML Files into Excel | Excel Discussion (Misc queries) | |||
Import multiple text files (Macro) | Excel Discussion (Misc queries) | |||
problem with import files by excel macro | Excel Discussion (Misc queries) | |||
Import CSV files using Macro | New Users to Excel |