As the printer code is long and complex I will start with the error solution.
*******************************************************
On Error Resume Next
Here you put your dodgy bit of code that may result in an error :)
Result = err.number - tells you if you have an error
err.number=0 -...
Yes, this works for all printers, and returns not just the printer name but the full network port and path which is needed for Excel but curiously enough not for Word ! This is what the code returns on my PC
SnagIt 8 on Ne00:
PDFCreator on Ne01:
Microsoft XPS Document Writer on Ne02:
DYMO...
I can give you the code for detecting and extracting the full path for each printer which is installed on a PC. You could then run the printer dialog and check for errors.
Let me know if that helps
I would like to preselect the folder that GetOpenFilename uses.
if a drive has been created I know that I can use ChDir and ChDrive, but the folder that I need is on a network and has the path "\\server\folder"
I want to just let the users select a file and not open it
Any help would be much...
I offered the code to register the user login name some time ago. It is relatively simple to put this code in the file to register the logged-in user on the machine that has opened it and then write the name and access times to a text logfile.
I use this code to screen users and allocate...
I can't really understand what you are trying to achieve with this.
Are you trying to track the changes occurring in the book ?
Why do you need two books if they are on the same computer ?
If they are not on the same computer why don't you use one shared book and let Microsoft track the changes...
Have Fun - any questions just post ! One thing that this does really well is to access SHARED excel Workbooks without adding extra users.Dont't forget the reference to ADO
Sub GetDataFromExcel()
'GET DATA FROM NAMED WORKBOOK OVEN RANGE
GetDataFromClosedWorkbook "\\Pc5525\C:\ Test.xls"...
An elegant way to do this is to treat the first Book as a database and use Microsoft ADO to access the data without opening the Book. This works best if you can give your data in the first book a Name.
Just to clarify...
Step 1 - Give your data range in Book 1 a name
Step 2 - Use ADO script to...
Just as a matter of interest, the Network Port is something that is created by the Windows operating system. On a PC where many printers have been installed, even if they have been subsequently deleted, the Network Port numbers will be higher than on a PC which has only one network printer. Each...
If you look at my code you will see that it does detect the true network port for each printer. I have been using this for years to detect each printer and then test for the correct network port.
I can give you code which will return the user logged in on the PC if that helps. As far as I am aware you can't track what you want using the file properties. You could get Excel to write a log of users each time the file is opened but that relies on having a Read/Write destination for your log...
This is the complete module that reads the XML file C:\Test into an Excel spreadsheet. Many thanks to Chance and Tsuji for their help.
'Include Reference to Microsoft XML (version 4 in my case)
Sub XMLtoExcel()
Dim xml_doc As New DOMDocument
Dim brtn As Boolean
Dim onode As IXMLDOMElement
brtn...
This is what I use to not only detect ALL available printers but also to add their Network Ports. Whereas Word will print to a printer name, Excel for some curious reason will not, it requires the full path, eg. \\X06 on Ne:02
Option Explicit
Const PRINTER_ENUM_CONNECTIONS = &H4
Const...
Thanks for your input Tsuji. Have tried using xml_doc.load instead of xml_doc.loadXML but it makes no difference. The macro does pause as the file is loaded but the end result is the same.
Sample of the XML file
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <powerdb.testdata version="1.0">...
Thanks Chance, making some progress
If I use ...
intR=1
For Each nde_Asset In xml_doc.selectNodes("//Asset")
with Sheet1
.cells(intR,1) = nde_Asset.selectSingleNode("FundCode").Text
.cells(intR,2) = str_distribution = nde_Asset.selectSingleNode("IncomeDistribution").Text
end with...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.