Link to home
Create AccountLog in
Avatar of Vivek Sethia
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
Avatar of Vivek Sethia
Vivek Sethia

ASKER

still waiting
Avatar of Joe Howard
What have you tried?
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.
Please try:
application.displayalerts=false
ActiveDocument.SaveAs2 FileName:="vivek", FileFormat:=wdFormatXMLDocument
application.displayalerts=true

Open in new window

- Should also define a path, inorder to save the doc in the desired folder

- The Fileformat should be docx right?
ASKER CERTIFIED SOLUTION
Avatar of Joe Howard
Joe Howard
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
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
please help
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
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

Error is :

this is not a valid file name
Problem solved.

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