PC Review


Reply
Thread Tools Rate Thread

changing .txt to .doc

 
 
New Member
Join Date: Mar 2007
Posts: 5
 
      29th Mar 2007
I have recorded a macro that modifies a .txt file and save the
modified file to my desktop but I am trying to keep the name of the
file to activesheet name. The trouble I am having is that it is saving
the file but with .txt not .doc even though it is a worddocument
file and not a text file
thanks

here is my code

Dim active As String


Selection.Delete Unit:=wdCharacter, Count:=1
Selection.EndKey Unit:=wdStory, Extend:=wdExtend
With Selection.Font
.Name = "Courier New"
.Size = 8
End With
With Selection.ParagraphFormat
.SpaceBeforeAuto = False
.SpaceAfterAuto = False
.LineSpacingRule = wdLineSpaceExactly
.LineSpacing = 7.5
.CharacterUnitLeftIndent = 0
.CharacterUnitRightIndent = 0
.CharacterUnitFirstLineIndent = 0
.LineUnitBefore = 0
.LineUnitAfter = 0
End With
With ActiveDocument.PageSetup
.LineNumbering.active = False
.Orientation = wdOrientLandscape
.TopMargin = InchesToPoints(0.75)
.BottomMargin = InchesToPoints(0.75)
.LeftMargin = InchesToPoints(0.95)
.RightMargin = InchesToPoints(0.5)
.Gutter = InchesToPoints(0.2)
.HeaderDistance = InchesToPoints(0.5)
.FooterDistance = InchesToPoints(0.5)
.PageWidth = InchesToPoints(11)
.PageHeight = InchesToPoints(8.5)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.GutterPos = wdGutterPosLeft
End With
ActiveDocument.PrintPreview
With ActiveDocument.PageSetup
.LineNumbering.active = False
.Orientation = wdOrientLandscape
.TopMargin = InchesToPoints(0.75)
.BottomMargin = InchesToPoints(0.75)
.LeftMargin = InchesToPoints(0.95)
.RightMargin = InchesToPoints(0.5)
.Gutter = InchesToPoints(0)
.HeaderDistance = InchesToPoints(0.5)
.FooterDistance = InchesToPoints(0.5)
.PageWidth = InchesToPoints(11)
.PageHeight = InchesToPoints(8.5)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.GutterPos = wdGutterPosLeft
End With
With ActiveDocument.PageSetup
.LineNumbering.active = False
.Orientation = wdOrientLandscape
.TopMargin = InchesToPoints(0.75)
.BottomMargin = InchesToPoints(0.75)
.LeftMargin = InchesToPoints(0.95)
.RightMargin = InchesToPoints(0.5)
.Gutter = InchesToPoints(0.2)
.HeaderDistance = InchesToPoints(0.5)
.FooterDistance = InchesToPoints(0.5)
.PageWidth = InchesToPoints(11)
.PageHeight = InchesToPoints(8.5)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.GutterPos = wdGutterPosLeft
End With
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.Font.Bold = wdToggle
Selection.TypeText Text:=" FORREST A. GARB & ASSOCIATES, INC."
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
ChangeFileOpenDirectory "C:\Documents and Settings\psingh\Desktop\"
active = ActiveDocument.Name
ActiveDocument.SaveAs FileName:=active & ".doc ", FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
End Sub

Last edited by putd; 29th Mar 2007 at 08:09 PM..
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NumberFormat not getting changing onFly changing the regional sett Dwipayan Das Microsoft Excel Programming 1 28th May 2010 07:55 PM
Changing row height in a data grid without changing font size =?Utf-8?B?S2FzZXk=?= Microsoft C# .NET 1 30th Jun 2006 12:20 AM
How to stop entire document style changing when changing 1 line? =?Utf-8?B?VHJveSBBLiBDb3VydG5leQ==?= Microsoft Word Document Management 4 1st May 2005 11:10 PM
Keeping Calendar times from changing when changing local time zone. George Lob Microsoft Outlook Discussion 1 22nd Nov 2004 05:14 PM
Difficulty in changing the Connection Server control path changing ... Samridhi Kumar Shukla Microsoft ASP .NET 1 30th Nov 2003 02:31 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:52 AM.