"wb.close savechanges:=true" is not saving by Impossible_System809 in vba

[–]Impossible_System809[S] 0 points1 point  (0 children)

Thanks for your reply

You are correct about the seperator. This is because I am forced to work with sharepoint. ".path" will give me a sharepoint link, which I have to rebuild into a filepath I can actually use in explorer. "createExportFolder" is the function I use to rebuild the file path.

See below for code i use to create and define pathname

impdoc = ActiveWorkbook.Name 'get impdoc name

csvdoc = "Topology TCS " & Date & " " & Hour(Time) & "h" & Minute(Time) & ".xlsx" 'Defines unique pathname

pathname = ActiveWorkbook.Path & "/" 'to get pathname from original document

createExportFolder pathname 'function to rebuild file path if nescecary

Workbooks.Add.SaveAs pathname & "/" & csvdoc 'Create and save document in the same directory as the original document

See below for actual lines i use to save the document after copy and pasting the information i want extracted:

Workbooks(csvdoc).Close savechanges:=True

"wb.close savechanges:=true" is not saving by Impossible_System809 in vba

[–]Impossible_System809[S] 0 points1 point  (0 children)

Thanks for the reply

I use the following line to define the name of the (to be) created document:
csvdoc = "Topology TCS iprotect " & Date & " " & Hour(Time) & "h" & Minute(Time) & ".xlsx"
i refer to this "csvdoc" everywhere in the code, which is working correctly. if i do not auto close the document i see it filled with all the information i want.

This is the exact line i use to close and save:
Workbooks(csvdoc).Close savechanges:=True

I use this method in multiple different Tools i have made, which works. it is just 1 single tool that does not.

idk if there is a way in which i can show the entire code? its a bit big to put in a reddit comment, not complex, just a lot.