Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8885561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:20:19+00:00 2026-06-14T21:20:19+00:00

I have a weird case in a word automation program I’m developing using the

  • 0

I have a weird case in a word automation program I’m developing using the Office Interop and C# 3.5

One task of the program is to copy any linked images in the word document to a different location and rewrite the Linked Source of those images to the new location.

Now, in one document, when I check the linked files (using Word 2010), it points an image to a location similar to images\image_file.jpg – So, the image is in a subfolder of the folder where the document is. That’s totally correct.

Linked image editscreen

But, when my program runs into that image, the LinkFormat.SourceFullName of that same image gives me a path on our local network, e.g. \\net-storage\customer\001 - customername\data\images\documents\image_file.jpg, without any correlation whatsoever to the actual image link I’m expecting.

What’s going wrong here? How do I get the correct image source in my program?

Edit to sw_lasse: I’m sure this is a relative path, because (in other documents) after deleting the image in the relative path and updating the fields in word, the image is not found. So it’s definitely a relative path.

Also, the two paths (network and relative) have no correlation to each other. The images on the network use a completely different folder hierarchy, so that’s why there’s a document subfolder, while it doesn’t exist in the relative path.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:20:21+00:00Added an answer on June 14, 2026 at 9:20 pm

    I know your writing VSTO C# code and this is VBA, but I believe this explains the odd behaviour your seeing.

    You cannot use:

    myPicPath = Options.DefaultFilePath(wdPicturesPath)
    

    … because if the user has inserted a picture from a different folder, the Default File Path returns that folder rather than the actual setting from the dialog box. Instead, you can use:

    With Dialogs(wdDialogToolsOptionsFileLocations)
        .Path = "PICTURE-PATH"
        .Update
        myPicPath = .Setting
    
        If Not Right$(myPicPath, 1) = "\" Then
            myPicPath = myPicPath + "\"
        End If
    
        MsgBox myPicPath 
    End With
    

    Similarly, you cannot use:

    myDocPath = Options.DefaultFilePath (wdDocumentsPath)
    

    to get the default document path, because this returns the current FileOpen path, not the default documents path!!

    Instead, use:

    Dim myDocPath As String
    myDocPath = Dialogs(wdDialogToolsOptionsFileLocations).Setting
    
    'Add a "\" at the end of the path, unless the setting is already followed by a "\" -
    'which it will be if the setting is set to a root folder 
    If Not Right$(myDocPath, 1) = "\" Then
        myDocPath = myDocPath + "\"
    End If
    
    MsgBox myDocPath
    

    These days I’m pretty good at converting VBA to C#, if you provide some code that doesn’t work I’ll convert this VBA to suit.

    Ref: How to retrieve Word’s default Documents path or Pictures path setting

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a weird issue with creating an Bitmap in C++. I'm using the
I have a weird case in my rails development that I'm not able to
I seem to have found a weird edge case where it seems that a
I have a weird case here.... I'm making a simple magento module right now.
Weird behavior when mixing loading of assemblies using Assembly.LoadFrom and Assembly.Load : I have
I have a bit of a weird use case where i need to change
I have this weird issue in Magento when someone places an order using PayPal
I have this little test-case which is supposed to show two widgets, with one
I have a weird case here at work. The customer(telecommunication firm) has a server
This is really really a weird case .. I have an application which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.