activeworkbook.close

  1. H

    Need to set up a constant

    I have set up a constant as follows Const C As String = .xlsm Sub Open_Fies () Windows("M_ERT Sales(P).xls").Activate Application.Run "'M_ERT Sales (P).xls'!Data_INPUT" ActiveWorkbook.Close Windows("M_ERT Sales (P)" & "C &").Activate ActiveWorkbook.Close Windows("Open...
  2. H

    Run Macro Data Export based on name of workbook on sheet1

    I have workbook names in sheet1. I would like to run the macro "Data Export" in each of these workbooks instead of macro below. If A new file/s files are added I need to amend the macro below each time There could be between 15 -20 workbooks on which to run the macro Sub Export_TB() 's()...
  3. A

    Activeworkbook.Close Problem

    Hi everyone, im unable to open my workbook due to the code below Private Sub Workbook_Open() Dim user as string User = Inputbox ("Please type your password") If typename(user)="albert" Msgbox "thank you" Else activeworkbook.Close End sub I tried a lot typing albert in the inputbox but still...
  4. D

    ActiveWorkbook.Close SaveChanges:=True Not Working???

    Hello all I have written a macro that does various things on a workbook. The Workbook is then saved and closed using the command ActiveWorkbook.Close SaveChanges:=True this command was working fine until I made various changes but now it now longer works. The last bits of my macro is as...
  5. B

    save & Clear

    Sub SaveInvWithNewName() Dim NewFN As Variant ' Copy Invoice to a new workbook ActiveSheet.Copy NewFN = "C:\Users\Donny\Google Drive\Data\Invoice" & Range("B15").Value & “.xlsx” ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook ActiveWorkbook.Close...
  6. M

    Auto-merging several xls into one

    Hello, I need your advice, in many vba project I have to merge several xls files into one. Im using almost always following code (below). What do you think about it? Is it efficient or maybe it could be done better and easier? I would be grateful if you could provide me examples how it will be...
  7. P

    ActiveWorkbook.Close closes both target book as well as unsaved workbook

    Hi there folks, its been awhile since I posted anything so if I did anything wrong please let me know. Ok to give some background... I have a bunch of code located in an addin which opens whenever I open excel. The addin contains a custom ribbon ui with various buttons doing various things...
  8. J

    Edit Code that runs on Workbook open and closes active workbook

    Hello, I have made a code that will run when opened via task scheduler. I have trusted the workbook so it doesnt prompt me for macro. My workbook open event calls the macro. After macro is complete, it closes the workbook containing the VBA. Without blocking macro's or untrusting the folder...
  9. A

    ActiveWorkbook.Close Failure

    I have consistently used ActiveWorkbook.Close in my macros without problem to both close other workbooks and to close the workbook in which the code itself is contained. However, suddenly that function still works when it is being used to close a workbook other than the one containing the code...

Watch MrExcel Video

This Week's Hot Topics

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
Top