Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3599044
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:19:07+00:00 2026-05-18T20:19:07+00:00

I’ve got a sheet setup with the following VBA: Sub PrintPDF() Application.DisplayAlerts = False

  • 0

I’ve got a sheet setup with the following VBA:

Sub PrintPDF()

Application.DisplayAlerts = False

    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "C:\Users\<insert_username>\Desktop\macro\Book1.pdf", Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False _

Application.Quit

End Sub

(which basically opens prints a PDF of the file and closes excel)

Then I’ve got this in the workbook:

Private Sub Workbook_Open()
Run "PrintPDF"
End Sub 

(which runs the PrintPDF macro “on load” — meaning when first thing when the excel file is opened.)

QUESTION:

So, what I’m missing now to finish out this task is some nice clean code to import a delimited file “on load” and map it to a fixed point in a single sheet.

Sample Data (with header row):

ID<TAB>Name<TAB>Location
1<TAB>John<TAB>US
2<TAB>Mike<TAB>CN
3<TAB>Tom<TAB>CA

Sample Excel Rows (after “on load” insert and mapping to cells):

<A1>null<B1>null<C1>null<D1>null
<A2>null<B2>ID<C2>Name<D2>Location
<A3>null<B3>1<C3>John<D3>US
<A4>null<B4>2<C4>Mike<D4>CN
<A5>null<B5>3<C5>Tom<D5>CA

(offset the data mapping because I’d like to make sure that I’m able to map the imported data to any where in the excel file as long as the row and column count match in both ends; both ends being the excel file and the delimited data source file; which they will 1-for-1.)

If you have any questions, let me know. The target system is Window 7 (Office 2010) or Mac 10.5 (Office 2011) — the code above is for Windows, but the only difference I believe would be the filename code, that being: “C:\Users\<insert_username>\Desktop\macro\Book1.pdf“


UPDATE:

Here’s the code I have so far, anything wrong with it:

Sub ImportCSV()
'
' ImportCSV Macro
'

'
    With ActiveSheet.QueryTables.Add(Connection:= _
        "TEXT;C:\Users\<insert_username>\Desktop\macro\sample_pipeline_data.txt", Destination:= _
        Range("$B$2"))
        .Name = "sample_pipeline_data"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .TextFilePromptOnRefresh = False
        .TextFilePlatform = 437
        .TextFileStartRow = 1
        .TextFileParseType = xlDelimited
        .TextFileTextQualifier = xlTextQualifierDoubleQuote
        .TextFileConsecutiveDelimiter = False
        .TextFileTabDelimiter = True
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = False
        .TextFileSpaceDelimiter = False
        .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
        .TextFileTrailingMinusNumbers = True
        .Refresh BackgroundQuery:=False
    End With
End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T20:19:07+00:00Added an answer on May 18, 2026 at 8:19 pm

    VBA is posted above in the body of my question, but the simple answer is that you can just record a macro using the built in PDF functions to automate this. One thing I would suggest is that you test this marco (or any marco) on the platforms it will be running on. For example, in the VBA code above which was generated using Office 2010 on Windows 7 — it will not work on Mac 10.5 (Office 2011) without running it in the debugger and deleting a few attributes that Mac’s version of office doesn’t support (though based on my testing, it appears very likely that they’re not supported by the Window’s version either, but just don’t throw errors.) If you ever have questions about the code/answer — just comment and I’ve be happy to provide any additional info.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
i got an object with contents of html markup in it, for example: string
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.