If can`t save as don`t do this

Adi21

Board Regular
Joined
Aug 11, 2014
Messages
62
Hi, I have a little problem and I hope that somebody can help me.
I have a workbook, and I want that when I`m closing it to be saved and save as on a site.The code that I write is working if I have internet access and I am log in with an user that can unpload documents on the site. But there are situations when I don`t have internet or I`m not log in an user with rights and in this kind of situations I get a dialog text to enter a username and password with access and an error. If I have this situations I want that the workbook to be save only and do not the save as. I tried with On error resume next ( I don`t know how to use it exactly) and is not working.Any ideas?Thanks!
Code:
Workbooks(lealde2).Save
Dim thefile, thepath As String
Let thepath = "[URL="http://teamwork.tenaris.net/sites/quality_Silcotub/Quality%20System/CapabilityAnalysis/CPKDimensional/DB/"]http://[/URL]...etc " 
Let thefile = "DatabaseLealde2.xlsm"
 On Error Resume Next
    Workbooks(lealde2).SaveAs Filename:=thepath & thefile _
        , FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
Workbooks(y).Worksheets("1").Activate
Workbooks(lealde2).Close SaveChanges:=True
 

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,214,515
Messages
6,119,974
Members
448,934
Latest member
audette89

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