C
Carlos Chalhoub
Hi listmates,
I want to open a document from the LAN loaded with hyperlinks to other documents nested in subfolders below. I need to create a macro that does the following:
1. Create a folder on my C drive which name mimics that of the active document (without the extension).
2. Save the active document to the the just created folder.
(I came up with this code, but it does not work)
strFileA = ActiveDocument.Name
pos = InStr(strFileA, ".")
If pos > 0 Then
strFileA = Left(myDocname, pos - 1)
End If
MkDir "C:\" & strFileA
strFileB = "C:\" & strFileA
' Define backup target file path.
ActiveDocument.SaveAs FileName:=strFileB
3. Grab all the hyperlinks in the active document and save the linked files to subfolders created according the path in the hyperlink, i.e. if the hyperlink address is
{ HYPERLINK "Process Flow\\BF2273Delete.f" }
then create a sub-folder (under the folder created at step 1) named "Process folder" and save the file "BF2273Delete.f" to it.
4. After closing the master document, would it be possible to go to the main folder (created at step 2) and zip it (using WinZip) with all the subfolders and files included?
Thanks for any pointers or help.
Carlos
I want to open a document from the LAN loaded with hyperlinks to other documents nested in subfolders below. I need to create a macro that does the following:
1. Create a folder on my C drive which name mimics that of the active document (without the extension).
2. Save the active document to the the just created folder.
(I came up with this code, but it does not work)
strFileA = ActiveDocument.Name
pos = InStr(strFileA, ".")
If pos > 0 Then
strFileA = Left(myDocname, pos - 1)
End If
MkDir "C:\" & strFileA
strFileB = "C:\" & strFileA
' Define backup target file path.
ActiveDocument.SaveAs FileName:=strFileB
3. Grab all the hyperlinks in the active document and save the linked files to subfolders created according the path in the hyperlink, i.e. if the hyperlink address is
{ HYPERLINK "Process Flow\\BF2273Delete.f" }
then create a sub-folder (under the folder created at step 1) named "Process folder" and save the file "BF2273Delete.f" to it.
4. After closing the master document, would it be possible to go to the main folder (created at step 2) and zip it (using WinZip) with all the subfolders and files included?
Thanks for any pointers or help.
Carlos