Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mia Mia is offline
external usenet poster
 
Posts: 101
Default Problem with formula

Hello,

For aprx. 1 year ago i got help with printing formula. Now I have bought
new computers and it don´t work. Do anyone know what could happend?

My formula is:

Sub menyskrivoffert()
'
' menyskrivoffert Makro


UserForm2.Show
If canc = 1 Then Exit Sub


Sheets("Offert MF").Select

Dim str As String

Dim strNetworkPrinter As String
str = Application.ActivePrinter

strNetworkPrinter = GetFullNetworkPrinterName("\\Server\NRG DSc428 Färg")

If Len(strNetworkPrinter) 0 Then
Application.ActivePrinter = strNetworkPrinter


' change to the network printer


ActiveWindow.SelectedSheets.PrintOut Copies:=1

End If

Application.ActivePrinter = str

Sheets("Meny").Select
End Sub


Function GetFullNetworkPrinterName(strNetworkPrinterName As String) As String
Dim strCurrentPrinterName As String, strTempPrinterName As String, i As
Long
strCurrentPrinterName = Application.ActivePrinter
i = 0
Do While i < 100
strTempPrinterName = strNetworkPrinterName & " på Ne" & Format(i,
"00") & ":"
On Error Resume Next ' try to change to the network printer
Application.ActivePrinter = strTempPrinterName
On Error GoTo 0
If Application.ActivePrinter = strTempPrinterName Then
GetFullNetworkPrinterName = strTempPrinterName
i = 100 ' makes the loop end
End If
i = i + 1
Loop
Application.ActivePrinter = strCurrentPrinterName ' change back to
the original printer
End Function


BR
Mia


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Problem with formula

Hi Mia

Has the printer been installed on the new computer?

//Per

"Mia" skrev i meddelelsen
...
Hello,

For aprx. 1 year ago i got help with printing formula. Now I have bought
new computers and it don´t work. Do anyone know what could happend?

My formula is:

Sub menyskrivoffert()
'
' menyskrivoffert Makro


UserForm2.Show
If canc = 1 Then Exit Sub


Sheets("Offert MF").Select

Dim str As String

Dim strNetworkPrinter As String
str = Application.ActivePrinter

strNetworkPrinter = GetFullNetworkPrinterName("\\Server\NRG DSc428
Färg")

If Len(strNetworkPrinter) 0 Then
Application.ActivePrinter = strNetworkPrinter


' change to the network printer


ActiveWindow.SelectedSheets.PrintOut Copies:=1

End If

Application.ActivePrinter = str

Sheets("Meny").Select
End Sub


Function GetFullNetworkPrinterName(strNetworkPrinterName As String) As
String
Dim strCurrentPrinterName As String, strTempPrinterName As String, i As
Long
strCurrentPrinterName = Application.ActivePrinter
i = 0
Do While i < 100
strTempPrinterName = strNetworkPrinterName & " på Ne" & Format(i,
"00") & ":"
On Error Resume Next ' try to change to the network printer
Application.ActivePrinter = strTempPrinterName
On Error GoTo 0
If Application.ActivePrinter = strTempPrinterName Then
GetFullNetworkPrinterName = strTempPrinterName
i = 100 ' makes the loop end
End If
i = i + 1
Loop
Application.ActivePrinter = strCurrentPrinterName ' change back to
the original printer
End Function


BR
Mia



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula Problem suzi_wells[_2_] Excel Programming 2 June 16th 08 05:16 PM
Formula problem Frances C[_2_] Excel Worksheet Functions 3 October 31st 07 09:25 PM
Formula problem Frances C[_2_] Excel Worksheet Functions 3 October 3rd 07 01:53 AM
Formula problem Rao Ratan Singh New Users to Excel 3 March 30th 06 04:23 PM
formula problem hhaddick Excel Programming 4 October 19th 03 11:25 PM


All times are GMT +1. The time now is 09:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"