asset
04-08-2013, 05:07 AM
Hello,
I have a macro which is specific to the project. It converts a text into three columns, deletes second and third column, then it should save file with 'docx' extension. Here lies a problem, docx is saved in another directory. I need this macro to save 'docx' version in the same directory.
Could someone help me with this part? Thanks!
Here is the current macro:
Sub Preparefortranslation()
'
'
'
'
Selection.WholeStory
WordBasic.TextToTable ConvertFrom:=1, NumColumns:=3, NumRows:=200, _
InitialColWidth:=wdAutoPosition, Format:=0, Apply:=1184, AutoFit:=0, _
SetDefault:=0, Word8:=0, Style:="Table Grid"
ActiveDocument.Tables(1).Columns(2).Select
Selection.Columns.Delete
ActiveDocument.Tables(1).Columns(2).Select
Selection.Columns.Delete
ActiveDocument.Tables(1).Columns(1).Select
Selection.Rows.ConvertToText Separator:=wdSeparateByTabs, NestedTables:= _
True
'here I have a problem with saving file in its current directory, because file get saved in another directory((
FileName = CreateObject("scripting.filesystemobject").getbasename(ActiveDocument.Name)
ActiveDocument.SaveAs FileName:=FileName, FileFormat:=wdFormatDocumentDefault
End Sub
I have a macro which is specific to the project. It converts a text into three columns, deletes second and third column, then it should save file with 'docx' extension. Here lies a problem, docx is saved in another directory. I need this macro to save 'docx' version in the same directory.
Could someone help me with this part? Thanks!
Here is the current macro:
Sub Preparefortranslation()
'
'
'
'
Selection.WholeStory
WordBasic.TextToTable ConvertFrom:=1, NumColumns:=3, NumRows:=200, _
InitialColWidth:=wdAutoPosition, Format:=0, Apply:=1184, AutoFit:=0, _
SetDefault:=0, Word8:=0, Style:="Table Grid"
ActiveDocument.Tables(1).Columns(2).Select
Selection.Columns.Delete
ActiveDocument.Tables(1).Columns(2).Select
Selection.Columns.Delete
ActiveDocument.Tables(1).Columns(1).Select
Selection.Rows.ConvertToText Separator:=wdSeparateByTabs, NestedTables:= _
True
'here I have a problem with saving file in its current directory, because file get saved in another directory((
FileName = CreateObject("scripting.filesystemobject").getbasename(ActiveDocument.Name)
ActiveDocument.SaveAs FileName:=FileName, FileFormat:=wdFormatDocumentDefault
End Sub