Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2005

Tip: Looking for answers? Try searching our database.

Save a Word File

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
maperalia - 09 Sep 2005 07:05 GMT
I have a macro that saves an Excel file with specific name and path (see
below).
However, I want to create a macro to save a word file as a doc in the same
way I am doing for excel.
The information I want to take from the word file to create the file name is
location in "Ln7,Col1" and "Ln8,Col1". The path will be C:\Mario\VB\Word and
the file name template is Sample1.dot

Thanks in advance.
Maperalia

Sub SaveExcelFile()

Dim Tract As String
Dim WO As String
Dim Supplier As String
Dim Dates As String
Dim Hours As String
Dim sFilename As String

WO = Worksheets("Gradation Form").Range("G2")
Tract = Worksheets("Gradation Form").Range("G3")
Supplier = Worksheets("Gradation Form").Range("C6")
Dates = Worksheets("Gradation Form").Range("G4")
Hours = Worksheets("Gradation Form").Range("G5")

Progname = "C:\Mario\VB\Excel\" & WO & "_" & Tract & "_" & Supplier & "_" &
Dates & "_" & Hours & ".xls"
ActiveWorkbook.SaveCopyAs Progname
End Sub
Word Heretic - 13 Sep 2005 15:09 GMT
G'day maperalia <maperalia@discussions.microsoft.com>,

Your ActiveDocument has a Table with Cells. Each cell contains 2 extra
characters at its end to mark end of content and end of cell. Eg

With ActiveDocument.Tables(1)
Name = StripCell(.cell(7,1)) & Stripcell(.cell(8,1)
end with
Activedocument.SaveAs name

Function StripCell(byval aCell as Cell) as String
StripCell = Acell.range.text
Stripcell = left$(stripcell, len(stripcell)-2)
End function

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice

maperalia reckoned:

>I have a macro that saves an Excel file with specific name and path (see
>below).
[quoted text clipped - 26 lines]
>ActiveWorkbook.SaveCopyAs Progname
>End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.