Code not working as it should

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,738
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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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