• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

how to add document properties to the saveas command in a macro?

ShellyTTC

New Member
I can use the saveas filename to make the file be saved to a sharepoint document area but we get an error first and if I ok it then we get the document information fields to fill in and then I click retry saving document and it continues successfull. Is there a way to add those Doc fields to the save as to avoid getting the warning error. What is the best way to accomplish this? thanks for your help. -Shelly

InsName = Application.InputBox("Enter the Instructor Name (example Camwe,Jarry)", Type:=2)
CrsName = Application.InputBox("Enter the Course Name (example PHI)", Type:=2)
NumSect = Application.InputBox("Enter the File Name (example 111 W05)", Type:=2)
ActiveDocument.ContentTypeProperties("Instructor Name").Value = InsName
ActiveDocument.ContentTypeProperties("Course Name").Value = CrsName
ActiveDocument.ContentTypeProperties("Course Prefix, Number, and Section").Value = NumSect
ActiveWorkbook.SaveAs Filename:= _
"https://.....Shared Documents/" & FName & ".xlsm" _
, FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
 
Hi, ShellyTTC!
No idea about Sharepoint, but... are you getting the error in the SaveAs line or anywhere else?
Regards!
 
Hi SirJB7:

Thanks for responding. yes when I walked thru the code above it errors on ActiveDocument.ContentTypeProperties...
I'm not sure what I should be using in excel vba - I was actually taking a stab at it hoping the error would let me back into an answer... maybe I'm trying to do something you can't do.
 
Hi, ShellyTTC!
Try replacing in the 3 lines previous to the SaveAs method:
ActiveDocument.xxx
by:
Activeworkbook.xxx
Regards!
 
well I think I got further but with a different error. without the code I would get to the save as and it would get me to the path but error because the fields are required in the document. I guess I need to search some more to find out a way to add those parms to the saveas command if that is possible. Below is the new error with the new code.If you have any other ideas I would love to give them a try. thanks again!

Run-time error'-2147216381(80041403)':

This document must contain Content Type Properties. Content Type properties are a common requirement for files in a document management system.
 
I was actually on the first link - checking it out and I'll check out the second one as well.

fyi... I moved the placement on the statements after the saveas and the first field worked but the other two fields did not work and errored out. The difference in the fields are the two that didn't work are multiple choice. maybe it is the type=2 I'm going to find out what the other types are maybe that is the issue.

thanks. -mc
 
Back
Top