Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[b]Add Picture problems[/b]

Status
Not open for further replies.

angiem

MIS
Sep 29, 2000
116
0
0
CA
Hi

I have a asp.net app that opens and inserts a photo into a word template. The problem is inserting the photo if I use 'C:\sunset.jpg' this works fine but if I use a mapped drive it doesn't. I get an error message saying it is not a valid file name.

this is the code
Code:
        Dim objWordApplication As New Application
        Dim objDocument As New Word.Document
        objDocument = objWordApplication.Documents.Add (OTemp)
        Dim v_range As Word.Range
         v_range.InsertParagraph()
                    '                     
                    With objWordApplication.Selection
                        .InlineShapes.AddPicture( _
                          filename:="Z:\winter.jpg", _
                          LinkToFile:=False, _
                          SaveWithDocument:=True, _
                            Range:=v_range)
                    End With

Thank you.



 
Use the UNC path. If you want to find out the UNC path for a mapped drive letter use this solution illustrated by strongm.

thread222-1019804

Swi
 

Your Z drive is probably some server that has an address od \\NtSvr5 or something, so try:

Code:
With objWordApplication.Selection
     .InlineShapes.AddPicture( _
     filename:=[blue]"\\NtSvr5\XYZ\winter.jpg"[/blue], _
     LinkToFile:=False, _
     SaveWithDocument:=True, _
     Range:=v_range)
End With

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top