Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Macro works correctly on my PC but not on others

Macro works correctly on my PC but not on others

Macro works correctly on my PC but not on others

I have a simple Excel macro that prints out vehicle inspection sheets. This is a chore that is done monthly at work. The macro prints sheets based on what vehicles are in a list. The sheets are named for each vehicle number and the list the macro refers to are the vehicle numbers to be printed. It will print all the vehicles in the list from my computer but for some others users it will print the first two vehicle sheets and end. I have experienced this with other similar type macros here at work and have been meaning to ask if anyone knows what's going on for some time. The excel file is stored on the network and all printing is done to network printers. Most users here have Office 365. If I step through the macro on one of the computers that it fails on it works without incident. It makes me think there might a timing issue. The code follows.


Sub VehicleForms()
' Print Vehicle Inspection forms

Dim lastrow As Long
Dim shtName As String
Dim i As Long

' Activate the worksheet with the vehicle list in column M
Worksheets("Set Date").Activate

' Get the number of the last row
lastrow = Cells(Rows.Count, 13).End(xlUp).Row 'The 13 is column M

' This line is in case someone leaves a blank cell in the list
' the code will skip to the next row
On Error Resume Next
' Loop through the list in column M printing each sheet
   For i = 2 To lastrow
     shtName = Cells(i, 13)
     Sheets(shtName).PrintOut Copies:=1

End Sub 

RE: Macro works correctly on my PC but not on others

Did you try to delay the execution of
Sheets(shtName).PrintOut Copies:=1
for a couple of seconds and see if that will help ponder

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson

RE: Macro works correctly on my PC but not on others


I added a two second delay and that did the trick. I still don't understand why. It always works if I print from my computer. All the computers in my office are on the same network. It may be that some users are on thin clients (I hate those). Those things are always slower. At least I got a fix.


RE: Macro works correctly on my PC but not on others

Maybe in MS Office options on your pc background printing is turned off.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close