Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-07-2020, 09:33 PM
leeqiang leeqiang is offline How to use vba to open a pdf file to a page you want? Windows 10 How to use vba to open a pdf file to a page you want? Office 2019
Advanced Beginner
How to use vba to open a pdf file to a page you want?
 
Join Date: Aug 2020
Posts: 53
leeqiang is on a distinguished road
Default How to use vba to open a pdf file to a page you want?


There is a pdf file name and its hyperlink on the excel form saved on the computer, how to write vba code to open the pdf file to the specified page. The specified page number can be entered in the form of an input box, thank you!
Reply With Quote
  #2  
Old 10-08-2020, 09:03 AM
Logit Logit is offline How to use vba to open a pdf file to a page you want? Windows 10 How to use vba to open a pdf file to a page you want? Office 2007
Expert
 
Join Date: Jan 2017
Posts: 529
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

.
Untested here : https://www.exceltrainingvideos.com/...ing-excel-vba/
Reply With Quote
  #3  
Old 10-08-2020, 09:41 PM
leeqiang leeqiang is offline How to use vba to open a pdf file to a page you want? Windows 10 How to use vba to open a pdf file to a page you want? Office 2019
Advanced Beginner
How to use vba to open a pdf file to a page you want?
 
Join Date: Aug 2020
Posts: 53
leeqiang is on a distinguished road
Default

Quote:
Originally Posted by Logit View Post



Sub openPDFFileXPage()
Dim oShell As Object
Dim nPage As Integer
Set oShell = CreateObject("WScript.shell")
nPage = Application.InputBox("page£º")
With oShell
.Run """C:\Users\N. Gregory Mankiw - Principles Of Economics (2021, Cengage Learning) - libgen.lc.pdf""", 5, False
.Run """C:\Users\N. Gregory Mankiw - Principles Of Economics (2021, Cengage Learning) - libgen.lc.pdf""", 5, True
.SendKeys "^+N"
.SendKeys VBA.CStr(nPage)
.SendKeys "{ENTER}"
End With
Set oShell = Nothing
End Sub



how to modify this code let the code automating add the file?
C:\Users\N. Gregory Mankiw - Principles Of Economics (2021, Cengage Learning) - libgen.lc.pdf
like the file link address added in a dialogue box to select on pdf file the code add the link after run""?

thx
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Every Folder I open goes into File Explorer but when I click on a file it won't open bird dog Word 3 10-08-2019 10:03 AM
How to use vba to open a pdf file to a page you want? HELP! Computer crashed, no recovery file, old versions, etc and file was open for over 24 hours! matthew.coppedge Word 2 04-07-2016 09:01 PM
How to use vba to open a pdf file to a page you want? Formula to open external file with specific program (like open with) pemartins Excel 16 02-24-2014 11:39 PM
How to use vba to open a pdf file to a page you want? excel cannot open the file .xlsx because the file format or file extension is not val teddysika Excel 1 11-22-2012 06:06 AM
Possible to open each page of file in a different window? Fran71 Word 2 04-27-2012 07:25 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:52 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft