Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have been successful in writing code that allows me to print a worksheet
within my workbook and then open up a Word document and print it as well. I basicly cut and pasted VBA from suggestions by those of you that use this discussion group. The Word document is located on my harddrive in the same subdirectory as my Excel workbook. This happens to be my C:\ drive. I use this same workbook file at work where the drive is F:\. Is there a way of referencing the document file without the directory drive so that it just assumes that it resides in the same subdirectory as the Excel file that is executing the macro? What I have been doing, which I know is rediculous, is changing the VBA reference drive based on the computer that I am using. Any help with this would be greatly appreciated. Thanks, Steve |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could put in an input box asking for the drive to use. Something
like: DriveLetter = InputBox("Please enter a drive letter") Then use that in your code when you determine the address. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thisworkbook.Path & Application.PathSeparator & "Yourfilename"
"SFGiants Fan" wrote: I have been successful in writing code that allows me to print a worksheet within my workbook and then open up a Word document and print it as well. I basicly cut and pasted VBA from suggestions by those of you that use this discussion group. The Word document is located on my harddrive in the same subdirectory as my Excel workbook. This happens to be my C:\ drive. I use this same workbook file at work where the drive is F:\. Is there a way of referencing the document file without the directory drive so that it just assumes that it resides in the same subdirectory as the Excel file that is executing the macro? What I have been doing, which I know is rediculous, is changing the VBA reference drive based on the computer that I am using. Any help with this would be greatly appreciated. Thanks, Steve |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Cell reference to make a directory path | Excel Worksheet Functions | |||
file save error: the file or directory cannot be created | Excel Discussion (Misc queries) | |||
Excel should let me sort the file directory when saving a file | Excel Discussion (Misc queries) | |||
Combine all text file in directory into one file. | Excel Programming | |||
get path - save new file - same sub-directory as existing file | Excel Programming |