Vivek Sethia
asked on
doc save _ vba
save a word doc using a vba.
the doc saved should not contain my code
the doc should be save in a new/desired folder
every time i run the code it should save a new version
the doc saved should not contain my code
the doc should be save in a new/desired folder
every time i run the code it should save a new version
What have you tried?
ASKER
ActiveDocument.SaveAs2 FileName:="vivek"
The problem is that it is saving the file along with the code. Hence i would want the doc to be saved in the desired folder and only a word doc.
The problem is that it is saving the file along with the code. Hence i would want the doc to be saved in the desired folder and only a word doc.
Please try:
application.displayalerts=false
ActiveDocument.SaveAs2 FileName:="vivek", FileFormat:=wdFormatXMLDocument
application.displayalerts=true
ASKER
- Should also define a path, inorder to save the doc in the desired folder
- The Fileformat should be docx right?
- The Fileformat should be docx right?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hi,
I am not able to unbold my lines
Current Use
'start new line after table'
myRange.EndOf wdStory, wdMove
myRange.InsertAfter " " & vbCr
myRange.InsertAfter "General Terms And conditions" & vbCr
myRange.InsertAfter " " & vbCr
'removing bold font
Selection.TypeText Text:="General Terms And conditions"
Selection.Font.Bold = False
I am not able to unbold my lines
Current Use
'start new line after table'
myRange.EndOf wdStory, wdMove
myRange.InsertAfter " " & vbCr
myRange.InsertAfter "General Terms And conditions" & vbCr
myRange.InsertAfter " " & vbCr
'removing bold font
Selection.TypeText Text:="General Terms And conditions"
Selection.Font.Bold = False
ASKER
please help
ASKER
Some Error
Code Used:
Dim filename As String
Application.DisplayAlerts = False
ActiveDocument.SaveAs2 filename:="C:\Users\Vivek\ Documents\ saving workbook\" & TBox10.Value & ".docx", Fileformat:=wdFormatXMLDoc ument
Application.DisplayAlerts = True
Code Used:
Dim filename As String
Application.DisplayAlerts = False
ActiveDocument.SaveAs2 filename:="C:\Users\Vivek\
Application.DisplayAlerts = True
What is the error?
try
try
Application.DisplayAlerts = False
ActiveDocument.SaveAs2 FileName:="C:\Users\Vivek\Documents\saving workbook\" & TBox10.Value & ".docx", Fileformat:=wdFormatXMLDocument
Application.DisplayAlerts = True
ASKER
Error is :
this is not a valid file name
this is not a valid file name
ASKER
Problem solved.
The Filename was Savingworkbook and Not Saving Workbook
The Filename was Savingworkbook and Not Saving Workbook
The original question was not solved by you!
You made a mistake which you corrected, but it has nothing to do with the solution which I gave in answers:
ID: 42455135
ID: 42457080
You made a mistake which you corrected, but it has nothing to do with the solution which I gave in answers:
ID: 42455135
ID: 42457080
ASKER