Weird type mismatch run-time error (13)

Dimitris254

Board Regular
Joined
Apr 25, 2016
Messages
139
i'm using Excel macro in a worksheet to read a cell, which then i put as in a textbox in PowerPoint.
Rich (BB code):
With PP_Slide.Shapes.AddTextbox(Orientation:=1, Left:=28, Top:=20, Width:=300, Height:=40).TextFrame.TextRange    
.Text = wsSheet.Cells(1, "A")
End With
the code works fine for 5 slides (it's in a loop apparently).

The weird is that every 5 slides i get the type mismatch error. The best is that if i simply press F5 to continue the macro, it will continue flawlessly (for 5 more slides).

:eek: :eek: :eek:
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
i'm using Excel macro in a worksheet to read a cell, which then i put as in a textbox in PowerPoint.
Rich (BB code):
With PP_Slide.Shapes.AddTextbox(Orientation:=1, Left:=28, Top:=20, Width:=300, Height:=40).TextFrame.TextRange    
.Text = wsSheet.Cells(1, "A")
End With
the code works fine for 5 slides (it's in a loop apparently).

The weird is that every 5 slides i get the type mismatch error. The best is that if i simply press F5 to continue the macro, it will continue flawlessly (for 5 more slides).

:eek: :eek: :eek:

That is certainally a weird bug. What is the data type you are trying to copy (text, numbers, both?).
Regardless of that, you said that if you press F5 again it continue flawlessly, try adding this to your code, before the with....

Code:
On Error Resume Next

It won't in fact solve the mismatch error, but might just work and you can go on with your life
 
Upvote 0
sry for the late reply, being working on that little bug

i tried error handling but the result was that the subtitle would disappear from the 6th slide onwards :eek:

i ended up storing the subtitle text to a string variable (e.g. subtitle_text = wsSheet.Cells(1, "A") ) and then using the variable to pass the title in the slide (ie. .Text = subtitle_text )

i can't imagine any other reason than being a memory/hardware issue, although i don't run out of memory or something.
 
Upvote 0

Forum statistics

Threads
1,216,134
Messages
6,129,070
Members
449,485
Latest member
greggy

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