i want to change the path so it saves to the current file location.

so lets say my current file is 'Z:\cdrfiles\myfile\123'then it should save to the current file open

Dim SaveOptions As StructSaveAsOptions
    Set SaveOptions = CreateStructSaveAsOptions
    With SaveOptions
       .EmbedVBAProject = True
       .Filter = cdrCDR
       .IncludeCMXData = False
        .Range = cdrAllPages
        .EmbedICCProfile = True
        .Version = cdrVersion15
    End With
    ActiveDocument.SaveAs Path, SaveOptions
End Sub

More Michael, welkom by Daniweb. Ons reels is dat ek dit in engels hou...

I deliberately used ActiveWorkbook rather than ThisWorkbook - make sure that you understand the difference.

Consider the following (and choose a workbook from a different directory to see the different path names).

Sub Test() 
    Dim filename As Variant 

    MsgBox "ThisWorkbook path is : " & ThisWorkbook.Path 

    filename = Application.GetOpenFilename(Title:="Test") 
    If filename = False Then Exit Sub 

    Workbooks.Open filename:=filename 
    MsgBox "The ActiveWorkbook path is : " & ActiveWorkbook.Path 

End Sub 

An alternative, depending on what you intend doing, would be to assign the newly opened file to a workbook variable so that you could use that, eg wbkName.Path.

You may also be interested in the ExtractPathName function that JW shows HERE. You'll find the file path samples a bit lower down.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.