Escaping Default Directory When Saving And Printing

Oct 16, 2009

This code works fine, as long as Excel isn't pointed to the default directory. But, when it is in the default directory ("My Documents" for me), then it will only save to the default directory. I need to save to a network drive. Is there a way to do this without me going to the "open" a new file button to switch out of the default directory?

View 2 Replies


ADVERTISEMENT

Saving Workbook In Newly Created Directory

Jun 18, 2009

I am trying to have the user hit a button and save the workbook in a newly created directory. Currently it creates the new workbook and the new directory with the correct names, however the workbook is not in the newly created directory.

View 5 Replies View Related

Saving Default Settings In Excel

Aug 20, 2013

I am working on lots of excels, with data queries from sql and pivot tables. Is there a way to set defaults to some settings in excel (not in this specific file).

To be more specific:

1. Import data from SQL: Refresh on opening, save password
2. Formatting of number to have two digits and a comma separator
3. Pivot table: when adding to values sum instead of count, refresh when opening the file

View 1 Replies View Related

Restrict Saving And Printing Spreadsheet

May 2, 2014

I need to restrict printing & saving functionality on a excel spreadsheet that is shared with a large group of people.

I was also hoping for the restricting save part, to do an AD lookup to see if they are a member of group "X", if they are then allow the save, if they are not then deny the save.

View 1 Replies View Related

List All Files From Directory And Sub Directory?

Sep 5, 2013

The script collects all the files in directory and sub-directories and list them in ascending format, I want them to get in transpose format. like for example: Root folder has many sub directories and in them a sub directory XYZ has 5 excel files, it will get the sub directory name in Col A and transpose all .xls files.

Col A | Col B________|Col C_________ |Col D___________|Col E________|
XYZ__|C:/root/test.xls|C:/root/Sales.xls |C:/root/Report.xls |C:/root/sam.xls|

[URL]

View 8 Replies View Related

Printing Multiple Workbooks With Printing Preference As Landscape

Jan 15, 2012

I would like to know if there is a way to print several different workbooks at once but keeping my printing format which I would like to be Landscape and Fit to one page. Reason is simple as I work in a office where staff is handed in several jobs to do everyday. They finish the jobs and log all the info on the database. I log on to database and put all their daily diaries and because it is all over the place I have to go in each file and set printing preferences which takes an hour in the morning and hour in the evening. I could do with some sort of automation where all diaries are automatically printed in Landscape and Fit on one page.

View 2 Replies View Related

Printing / Not Printing Ranges Based On Cell Contents

Apr 11, 2008

I have a report that is generated from a manufacturing process that looks like the example below. the report is 40 pages long when all the data is printed. i am looking for a way to only print this range if a dimension is "out of tolerance". if the dimension is within tolerance, there is always the "garbage" text of plus and minus. if every row is "within tolerance" in the range the cells in the OutTol column would all contain the "garbage" text but it will not always be identical. so, in summary, actual OutTol values = print and all "garbage" = not printed.

NomActDevLoTolUpTolOutTol
Y-0.956-0.9480.008-0.0030.0030.005
Z-1.413-1.4130.000-0.0030.003---*|++++
DIA0.4220.4240.002-0.0030.006----|+*++
POS0.0160.0110.005

View 9 Replies View Related

Prompt User For Directory And Filename; Then Save File In Directory With File Name

Jun 10, 2009

I am trying to prompt the user for the directory to be saved in and file name to be saved as; then save the workbook in the input directory with the inputted file name.

View 3 Replies View Related

Saving A File Without Saving Macro

Jan 30, 2003

I have a spreadsheet that imports data, manipulates it then deletes 2 of the sheets then saves the file under a different name to the network. Is there any way to save this new worksheet without it storing the macros - so when the user open it, only the data is there and they get no prompt to enable macros?

View 6 Replies View Related

Saving User Inputted Data From A Worksheet To Another Worksheet And Saving It

Jan 7, 2009

I have created a form in a worksheet which I have added questions too and then locked all cells except the ones where I want the answers in.

I have then added a button to the bottom of the sheet called "Print and Save". This work sheet is called "form"

On a second sheet called "database", I have all the titles of the questions running from a -> k and nother else.

What I want to happen is the user input the information on "form" into the boxes available. Once they have completed the questions, I want them to be able to click on "Print and Save" so that firstly the page "form" prints, and then for all of the answers to be saved in "database" below the titles for each question.

I have had a play, but just don't know where to start. Also, once there is a row of questions below the titles, I don't want it to overwrite information already there, it needs to go onto the next empty row available.

Attached is my excel file.

You will see in the code that I have the code for printing.. I just found this on the net and it seems to work fine for me.

View 9 Replies View Related

How To Get A Directory

Apr 22, 2009

The command Application.GetOpenFilename will open a explorer to be able to choose a file, what is the command to open a explorer but only to choose a directory?. Is there such a command?.

View 7 Replies View Related

Save To Different Directory

Feb 2, 2010

The Kill function works OK but the ThisWorkbook.SaveAs part does not work for some reason.

Please note that there are 2-spaces between the words: P3 CATS

View 12 Replies View Related

Search For A Directory Using VBA

Dec 20, 2011

For a macro i'm writing I need to search for a directory.

Users enter a projectnumber, this is being used for a search string.

But how can I search for folders/directories in Windows?

I've got the startfolder: 'C:Projects'

Then the project which the user is searching for can be in several subdirectories.

View 4 Replies View Related

Save To A Directory

May 11, 2006

1. Is it possible to save additional worksheets (right now it is only copying one worksheet)?
2. How can I hard-code the directory path so the file goes to that one locatin (i.e. the "master directory")?

Also, is it possible to save userforms out of this workbook (i.e. some of the userforms contain information that is useful...it would be great to have them in the "output" file that gets saved to the "master directory"). Thanks!


Private Sub SAPfile_Click()

myfile = Application.GetSaveAsFilename(fileFilter:="Excel Files (*.xls), *.xls")
Worksheets("Output-SAP Plan").Copy

ActiveWorkbook.SaveAs myfile

ActiveWorkbook.Close

MsgBox "SAP file created."

End Sub

View 9 Replies View Related

Print Directory Using VBA

Jul 6, 2006

I've been looking for code to print Excel files from a directory with multiple worksheets. I found something close on this forum, but it prints 2 copies which is fine for pdf, but not for hard copy. I would like just 1 copy.

Sub PrintPDF_PLOTDIR()
Dim PATH As String
Dim FileName As String
Dim Wkb As Workbook
Dim WS As Worksheet
Application.EnableEvents = False
Application. ScreenUpdating = False
PATH = "C:DATA\_PLOTDIR"
FileName = Dir(PATH & "*.xls", vbNormal)
Do Until FileName = ""
Set Wkb = Workbooks.Open(FileName:=PATH & "" & FileName)
Application.ActivePrinter = "Adobe PDF on Ne00:"
For Each WS In Wkb.Worksheets
ActiveWorkbook.printout Copies:=1, Collate:=True
Next WS
Wkb.Close False
FileName = Dir()
Loop
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub

View 2 Replies View Related

Find Parent Directory

Nov 5, 2008

Imagine this:
* Main Category #1
Sub Title #1: "Value"
Sub Title #2: "Value"
Sub Title #3: "Value"
Sub Title #4: "Value"
* Main Category #2
Sub Title #1: "Value"
Sub Title #2: "Value"
Sub Title #3: "Value"
Sub Title #4: "Value"
Sub Title #5: "Value"
Sub Title #6: "Value"
Sub Title #7: "Value"
Sub Title #8: "Value"
Sub Title #9: "Value".................

Main categories and subtitles are in the same column. "Value"s are in the column to the right.

I want to make a list in the columns to the right. This list will only show something if the "value" is not zero. It will show in the first column right from the original list, the main category to which the subtitle belongs to and the subtitle. Something like this (imagine subtitle #2 from cat #1 and #2 and #3 from cat #2 are not zero):

View 4 Replies View Related

Add Or Delete Directory In The List

Apr 29, 2014

I want to have a excel file with VBA code and it should operate like the following:

It should check the subdirectory's in a certain directory and put this on a excel sheet.

Every time when you start the sheet it should compare the sheet with the sub directory's and make al the changes in the list.

In the end the excel sheet should be a representation of the directory.

I can't get it to work when something is changed or a directory is added or deleted.

[Code] ....

View 1 Replies View Related

Dialogs SaveAs With Different Directory

Aug 6, 2005

An already existing file will be changed by my macro and at the end I want the user to save the file with a different name in a different directory with the option to change the filename or directory. Therefore I use the excel-standard-dialog "save as". But I want the dialog to start in another path as the path the original-file is stored in. But also I use the ChDrive and ChDir Parameters the dialog even starts in the original-file-path. I think this is standard for the dialog and I should maybe use a parameter in the show-arguement? The code is below.

Option Explicit
Sub SaveMyFile()
Dim xFileName, xAnswer
ChDrive "J"
ChDir "J:myfolder"
xFileName = "testme.xls"
xAnswer = Application.Dialogs(xlDialogSaveAs).Show(xFileName)
End Sub

View 5 Replies View Related

Changing Referenced Directory

Oct 12, 2008

I had posted earlier and felt I had solved my problem, but I have not. What I am trying to do is use code to change directory when the save menu is activated.

I want to be able to open from one location and then it defaults to another. I have tried "chdir" , but I can't seem to get it to work. Even when I change the DefaultFilePath, the "save as" location defaults to the location where the file was opened from. I want to default all "saves" in a specific location without using the menu to select.

View 8 Replies View Related

Dialog To Select A Directory

Oct 17, 2008

Is there a dialog box like the one used in GetOpenFilename that can be used to select a directory?

I'm trying to select a directory/folder which will change each month but the macro selects the files from inside the folder once it's specified. I don't need the name of the current path; the path name needs to be able to be selected.

View 2 Replies View Related

SaveAs To Same Directory But Different File Name

Feb 4, 2009

By Code I am trying to SaveAs the present Workbook : Only in the same directory as the present Workbook- but with a different file name. The new file name would be :"the Filename of the Active Workbook" + " ("D9") of the Sheet("ADMIN")". This macro will only be run from the Sheet("Admin").

View 4 Replies View Related

Directory Names On Different Computers

Aug 3, 2009

I have been limited lately to only working on this project at work because I have added a few lines here and there throughout the workbook that make a reference to the directory the file is located in. for example:

View 2 Replies View Related

Static Data For Directory

Oct 3, 2011

I have multiple VBA modules that all refer to directories on the local machine and across the network.

I am currently defining the directories in each module.

How can I define them once and then refer to them in any module?

Set Word_Template_Name = "Sanitary Survey Template.dotx"
Set Excel_Template_Name = "Sanitary Survey Blank.xlsm"
Set WQCDdir = "c:CO Sanitary Survey"
Set WQCD_Source_Dir_File = "...wqcProgramsSDWEngineeringTemplates"

This would ensure that any directory changes could be made once rather than 5 times.

View 1 Replies View Related

Manipulate Code To Add New Directory

May 21, 2012

Here is the code:

Code:
Option Explicit
Option Compare Text 'for Case-Sensitive matching change Text to Binary
Sub List_Matches()
Dim sPattern As String, sPath As String, sJob As String
Dim sMainDir As String, sCommonSub As String
Dim c As Range, lRow As Long
Dim d As Range
Range("B:B").Clear
lRow = Cells(Rows.Count, "E").End(xlUp).Row
If lRow < 8 Then Exit Sub

[Code] ...........

The red is the part that I tried to manipulate to add the new directory, the problem I can see is that the new directory contains folders with the following name "WO#____" as i can see the # sign is probably throwing the program off because it can't open up the link to that folder in order to look for files. The program as it stands still works fine with looking up the first directory. I also know we had created a function to solve the sign problem for directory 1 file names. How can i use that function to directory 2.

View 1 Replies View Related

Add Folders To All Directories Within Another Directory?

Nov 29, 2012

I am trying to automate some of the work I used to do as I have moved to another position, specifically trying to automate file management. I am using this code to create new files for each client

Code:
Public Sub CheckDir(fold1 As String)
If Dir(fold1, vbDirectory) = "" Then
MkDir fold1
Else
End If
End Sub

which works great, but you still have to do one client at a time. Basically I'm using this code to create new client files, but each year we will need to add a directory and sub directories for every client in a certain directory. What I would like to do is code a macro that would add say a "2013" folder with all appropriate sub directories to every client folder within the folder that contains all of the client folders The folder hierarchy should look like this

Code:
'F:Clients
'F:ClientsClientName
'F:ClientsClientName2013
'F:ClientsClientName2013RandomOtherFolders

I assume it would use a For/Each, but I'm not sure how to go about it.

View 3 Replies View Related

Looping Through Each File In Directory?

Mar 5, 2013

How can i loop through each excel file in a directory.

View 1 Replies View Related

Using Current Directory In Save Name?

May 15, 2013

I am trying to use VB to save a workbook into the same directory but with a file name that references the folder it is stored in...if that makes sense!

Here is where I have got to so far but fails on save,

Sub Rename()
Application.DisplayAlerts = False
mdy = Month(Now()) & "." & Day(Now()) & "." & Year(Now())
fold = ThisWorkbook.Path
FName = fold & "-" & mdy & "-(New).xls"
SaveName = fold & "" & FName
ActiveWorkbook.SaveAs (SaveName)
Application.DisplayAlerts = True
End Sub

View 3 Replies View Related

File List From Directory

Jul 1, 2013

I have a spreadsheet, where the corresponding invoice number is located in column I.

All the necessary invoices have been scanned in as pdf's in folder Y:FinanceSalesInvoices.

The question is, can a code be written to say in column Z, that a hyperlink be created to that particular invoice. For example, in cell I2, it would have Invoice1, then in cell Z2, it would have a hyperlink of Y:FinanceSalesInvoicesInvoice1.pdf.

View 1 Replies View Related

Looping Files In Directory - VBA

Aug 22, 2013

I wrote the following routine to loop files in folder. I have 4 .xls files in my test folder. This code is only grabbing 1 then exiting. I have used the Dir() loop before with no problems.

Code:
Private Sub GetDataMultipleFiles(ByVal importExt As String, ByVal xFileNum As Integer, ByVal importLoc As String)
Dim Sep As String, myFile As String
Sep = Application.PathSeparator
myFile = Dir(importLoc & Sep & "*" & importExt & "*")
Do While Len(myFile) > 0

[Code] ..........

View 2 Replies View Related

Hyperlink Dynamic Directory

May 27, 2014

I have a word 2010 file with some hyperlinks to some Excel files and Excel cells. All these files are within a a single folder that I shall send to another pc. I don't know how to make the hyperlink directory path the same as the word file except for the file name.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved