I've searched everywhere and I've tried using the tips I've come across, however I still run into isses using Thisworkbook.path.
This code works fine if I use $Environ(username), and put the path, but I'm not sure the other ones in my office has the onedrive folder saved in the same location.
It would then also only work if synced to PC, so I'm trying to work around this solution.
Turning off sync to cloud is not an option as there are several working with this sheet daily.
My code is as follows now, please help me locate the issue. (I get path/access error (75) even tho Thisworkbook.path works in other macros exporting PDF to folders in the same location).
It seems neither the Exportpath or the LoadPicture is working with this at the moment, but first of all I'm stuck with this line:
This code works fine if I use $Environ(username), and put the path, but I'm not sure the other ones in my office has the onedrive folder saved in the same location.
It would then also only work if synced to PC, so I'm trying to work around this solution.
Turning off sync to cloud is not an option as there are several working with this sheet daily.
My code is as follows now, please help me locate the issue. (I get path/access error (75) even tho Thisworkbook.path works in other macros exporting PDF to folders in the same location).
It seems neither the Exportpath or the LoadPicture is working with this at the moment, but first of all I'm stuck with this line:
VBA Code:
.Export Filename:=Exportpath, FilterName:="bmp"
VBA Code:
Set oWs = Ark3
Set oRng = oWs.Range("A1:O36")
Exportpath = ThisWorkbook.Path & "/" & "temp" & "/" & "PLAN.bmp"
oRng.CopyPicture xlScreen, xlPicture
lWidth = oRng.Width
lHeight = oRng.Height
Worksheets("PLAN").Unprotect
Set oChrtO = oWs.ChartObjects.Add(Left:=0, Top:=0, Width:=lWidth, Height:=lHeight)
oChrtO.Activate
With oChrtO.Chart
.Paste
.Export Filename:=Exportpath, FilterName:="bmp"
End With
oChrtO.Delete
IMGplanen.Picture = LoadPicture(ThisWorkbook.Path & "/" & "temp" & "/" & "PLAN.bmp")