Loading an image error

Cozzy123

New Member
Joined
Aug 10, 2016
Messages
28
Hi all,

I'm probably doing something wrong, this code worked before but I'm getting a debug?

Any ideas?

Sub DrawChart()
Dim CurrentFileName As String
CurrentFileName = ThisWorkbook.Path & "\current.gif"

Dim CurrentChart As Chart
Set CurrentChart = ThisWorkbook.Sheets("Charts").ChartObjects("Compliance").Chart
CurrentChart.Export Filename:=CurrentFileName, filtername:="GIF"

Dashboard.Image1.Picture = LoadPicture(CurrentFileName)
End Sub
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
righto, its going to the wrong location, its added the wrong path, not sure why? could it be that its linked to something else?
 
Upvote 0
It's using the path of the workbook with the code in. If that's in onedrive, you might be getting a d.docs.live.net/... type path?
 
Upvote 0
It's using the path of the workbook with the code in. If that's in onedrive, you might be getting a d.docs.live.net/... type path?
Righto, I'm sorry to have said, it is the correct path. Its taken it to my Sharepoint path.
 
Upvote 0
Righto, I'm sorry to have said, it is the correct path. Its taken it to my Sharepoint path.

Can you post your Sharepoint path here so we can assess?
(note if your Sharepoint path contains anything sensitive, like company name that you don't want to post, just replace those letters with something made up. The important point is to assess overall format).
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top