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
Vivek SethiaAsked:
Who is Participating?
 
MacroShadowConnect With a Mentor Commented:
Instead of vivek put the full file name including the path.
wdFormatXMLDocument will give you a docx without the code.
0
 
Vivek SethiaAuthor Commented:
still waiting
0
 
MacroShadowCommented:
What have you tried?
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Vivek SethiaAuthor Commented:
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.
0
 
MacroShadowCommented:
Please try:
application.displayalerts=false
ActiveDocument.SaveAs2 FileName:="vivek", FileFormat:=wdFormatXMLDocument
application.displayalerts=true

Open in new window

0
 
Vivek SethiaAuthor Commented:
- Should also define a path, inorder to save the doc in the desired folder

- The Fileformat should be docx right?
0
 
Vivek SethiaAuthor Commented:
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
0
 
Vivek SethiaAuthor Commented:
please help
0
 
Vivek SethiaAuthor Commented:
Some Error

Code Used:

Dim filename As String
Application.DisplayAlerts = False
ActiveDocument.SaveAs2 filename:="C:\Users\Vivek\Documents\saving workbook\" & TBox10.Value & ".docx", Fileformat:=wdFormatXMLDocument
Application.DisplayAlerts = True
0
 
MacroShadowCommented:
What is the error?

try
Application.DisplayAlerts = False
ActiveDocument.SaveAs2 FileName:="C:\Users\Vivek\Documents\saving workbook\" & TBox10.Value & ".docx", Fileformat:=wdFormatXMLDocument
Application.DisplayAlerts = True 

Open in new window

0
 
Vivek SethiaAuthor Commented:
Error is :

this is not a valid file name
0
 
Vivek SethiaAuthor Commented:
Problem solved.

The Filename was Savingworkbook and Not Saving Workbook
0
 
MacroShadowCommented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.