.Name Method or Data Member Not Found

Pestomania

Active Member
Joined
May 30, 2018
Messages
332
Office Version
  1. 365
Platform
  1. Windows
Hi everyone,


I've used this code many times but have never seen this error. Can anyone help?


Code:
Sub Printer ()

Dim wbk as workbooks
Application.displayalerts = false

For each wbk in workbooks
   If left(wbk.name, 8) = "EBMF_POW" THEN
   Wbk.activate

~~printer code~~

End if
Next wbk

End sub

I've never seen the Method or Data Member Not Round

Like I said, I've used this code multiple times, just adapted it with different names. Please help if this issue can be fixed.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
That's because you've declared wbk as workbooks, instead of workbook. So you'll need to declare it as follows...

Code:
Dim wbk As Workbook
 
Upvote 0
To set the printer properties for all workbooks, except the one that starts with "EBMF_POW", you'll need to change the comparison operator for the If statement from "equals to" (=) to "does not equal to" (<>)...

Code:
If left(wbk.name, 8) <> "EBMF_POW" THEN
 
Last edited:
Upvote 0
To set the printer properties for all workbooks, except the one that starts with "EBMF_POW", you'll need to change the comparison operator for the If statement from "equals to" (=) to "does not equal to" (<>)...

Code:
If left(wbk.name, 8) <> "EBMF_POW" THEN

Im needing it to cycle through the open workbooks and determine if the left 8 are EBMF_POW if so, a msgbox "would you like to print". Instead it's just printing the same workbook over and over, not looping.
 
Upvote 0
Oh I see. So you have more than one opened workbook whose name starts with "EBMF_POW", and you want to set the print properties for each one of those. In that case, your code should work. If not, check whether the workbook names have extra spaces or spelling mistakes.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,021
Latest member
Justyna P

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