Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need some help with this macro plzzz!!

Hey guyz can someone plz help a beginner with some macros here!!
I need a macro to "read" text or "file name" from an excel sheet ,
search the directory or any path defined. locate the document and
insert it in a word doc( predefined word doc.)

I know I sound confusing, This macro is basically suppose to help in
creating proposals in word from price sheets in excel.
I got this code: It sort of does what i want but i need your help in
some modifications plzzz.

Sub DirLoop()
Dim MyFile As String, Sep As String, filename1 As String
filename1 = "H:\2006\Course Description\AIX 5L"
' Sets up the variable "MyFile" to be each file in the directory
' This example looks for all the files that have an .xls extension.
' This can be changed to whatever extension is needed. Also, this
' macro searches the current directory. This can be changed to any
' directory.
' Test for Windows or Macintosh platform. Make the directory request.
Sep = Application.PathSeparator
If Sep = "\" Then
' Windows platform search syntax.
MyFile = Dir(filename1 & Sep & "*.doc")
Else
' Macintosh platform search syntax.
' MyFile = Dir("", MacID("XLS5"))
End If
' Starts the loop, which will continue until there are no more files
' found.
Do While MyFile < ""
' Displays a message box with the name of the file. This can be
' changed to any procedure that would be needed to run on every
' file in the directory such as opening each file.
MsgBox filename1 & Sep & MyFile
MyFile = Dir()
Loop
End Sub
This macro DOES NOT search it reads and displays every singal file name
in the directory. problem is I want it to search for the specific file
name given and insert it in the word template rather then reading and
displaying all file names in msgboxs
can any one help plzz.
Thanx
regards
Maria

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Need some help with this macro plzzz!!

If you know the fully qualified filename, then there is no searching
involved. You just open the file.



--
Regards,
Tom Ogilvy

"Maria" wrote in message
oups.com...
Hey guyz can someone plz help a beginner with some macros here!!
I need a macro to "read" text or "file name" from an excel sheet ,
search the directory or any path defined. locate the document and
insert it in a word doc( predefined word doc.)

I know I sound confusing, This macro is basically suppose to help in
creating proposals in word from price sheets in excel.
I got this code: It sort of does what i want but i need your help in
some modifications plzzz.

Sub DirLoop()
Dim MyFile As String, Sep As String, filename1 As String
filename1 = "H:\2006\Course Description\AIX 5L"
' Sets up the variable "MyFile" to be each file in the directory
' This example looks for all the files that have an .xls extension.
' This can be changed to whatever extension is needed. Also, this
' macro searches the current directory. This can be changed to any
' directory.
' Test for Windows or Macintosh platform. Make the directory request.
Sep = Application.PathSeparator
If Sep = "\" Then
' Windows platform search syntax.
MyFile = Dir(filename1 & Sep & "*.doc")
Else
' Macintosh platform search syntax.
' MyFile = Dir("", MacID("XLS5"))
End If
' Starts the loop, which will continue until there are no more files
' found.
Do While MyFile < ""
' Displays a message box with the name of the file. This can be
' changed to any procedure that would be needed to run on every
' file in the directory such as opening each file.
MsgBox filename1 & Sep & MyFile
MyFile = Dir()
Loop
End Sub
This macro DOES NOT search it reads and displays every singal file name
in the directory. problem is I want it to search for the specific file
name given and insert it in the word template rather then reading and
displaying all file names in msgboxs
can any one help plzz.
Thanx
regards
Maria



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
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Need some help plzzz Maria.N Excel Programming 0 July 11th 06 02:49 PM
"IF Condition" formula.... any help plzzz?! blindhunter Excel Discussion (Misc queries) 3 June 21st 06 12:36 PM
Excel Help with pictures plzzz KostasH Excel Discussion (Misc queries) 3 April 7th 06 01:46 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 04:14 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"