Code not working as it should

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,832
Office Version
  1. 2007
Platform
  1. Windows
Morning,

I am using the code supplied below.
Currently with my userform open when the button OPEN INVOICE is pressed the code opens up the invoice which is saved on the pc by its invoice number which is shown in the userform invoice number field.

If N/A is in the field then i see the message box no problem.
If say 123 is shown in the field then invoice 123 is then opened & now seen no problem.

This is the issue i have come across, should 150 be in the invoice number field BUT the invoice 150 for some reason had been deleted from the pc upon pressing the OPEN INVOICE button nothing happens,it should at least advise me that no invoice was not found.

Many thanks



Code:
Private Sub OpenInvoice_Click()    If IsNumeric(txtInvoiceNumber.Value) Then
        CreateObject("Shell.Application").Open "C:\Users\Ian\Desktop\REMOTES ETC\DR COPY INVOICES\" & txtInvoiceNumber.Value & ".pdf"
    Else
        MsgBox "Invoice N/A For This Customer"
    End If


End Sub
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,224,828
Messages
6,181,212
Members
453,023
Latest member
alabaz

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